code_corps v0.0.1 CodeCorps.GitHub.TestHelpers View Source
Link to this section Summary
Functions
Allows setting a mock Github API module for usage in specific tests To use it, define a module containing the methods expected to be called, then pass in the block of code expected to call it into the macro:
defmodule MyApiModule do
def some_function, do: "foo"
end
with_mock_api(MyApiModule) do
execute_code_calling_api
end
Link to this section Functions
Link to this function
load_endpoint_fixture(id)
View Source
load_endpoint_fixture(String.t()) :: map()
Link to this function
setup_coderly_repo()
View Source
setup_coderly_repo() :: %CodeCorps.GithubRepo{__meta__: term(), github_account_avatar_url: term(), github_account_id: term(), github_account_login: term(), github_account_type: term(), github_app_installation: term(), github_app_installation_id: term(), github_comments: term(), github_id: term(), github_issues: term(), id: term(), inserted_at: term(), name: term(), project: term(), project_id: term(), sync_state: term(), syncing_comments_count: term(), syncing_issues_count: term(), syncing_pull_requests_count: term(), updated_at: term()}
Link to this function
setup_real_repo(repo_owner, repo_name, repo_owner_id, app_github_id, repo_github_id)
View Source
setup_real_repo(String.t(), String.t(), Integer.t(), Integer.t(), Integer.t()) :: %CodeCorps.GithubRepo{__meta__: term(), github_account_avatar_url: term(), github_account_id: term(), github_account_login: term(), github_account_type: term(), github_app_installation: term(), github_app_installation_id: term(), github_comments: term(), github_id: term(), github_issues: term(), id: term(), inserted_at: term(), name: term(), project: term(), project_id: term(), sync_state: term(), syncing_comments_count: term(), syncing_issues_count: term(), syncing_pull_requests_count: term(), updated_at: term()}
Link to this macro
with_mock_api(mock_module, list)
View Source
(macro)
with_mock_api(module(), [{:do, function()}]) :: any()
Allows setting a mock Github API module for usage in specific tests To use it, define a module containing the methods expected to be called, then pass in the block of code expected to call it into the macro:
defmodule MyApiModule do
def some_function, do: "foo"
end
with_mock_api(MyApiModule) do
execute_code_calling_api
end
Link to this macro
with_real_api(list)
View Source
(macro)
with_real_api([{:do, function()}]) :: any()