cumulusci.core.tests package

Submodules

This class is used by test_pageobjects

class cumulusci.core.tests.BarTestPage.BarTestPage(object_name=None)[source]

Bases: cumulusci.robotframework.pageobjects.baseobjects.BasePage

bar_keyword_1(message)[source]
bar_keyword_2(message)[source]
class cumulusci.core.tests.FooTestPage.FooTestPage(object_name=None)[source]

Bases: cumulusci.robotframework.pageobjects.baseobjects.BasePage

foo_keyword_1(message)[source]
class cumulusci.core.tests.test_config_expensive.TestBaseGlobalConfig(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_load_global_config_empty_local(mock_class)[source]
test_load_global_config_no_local(mock_class)[source]
test_load_global_config_with_local(mock_class)[source]
class cumulusci.core.tests.test_config_expensive.TestBaseProjectConfig(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_load_additional_yaml(mock_class)[source]
test_load_project_config_empty_config(mock_class)[source]
test_load_project_config_local(mock_class)[source]
test_load_project_config_no_config(mock_class)[source]
test_load_project_config_not_repo(mock_class)[source]
test_load_project_config_valid_config(mock_class)[source]
test_repo_branch(mock_class)[source]
test_repo_commit(mock_class)[source]
test_repo_owner(mock_class)[source]
class cumulusci.core.tests.test_config_expensive.TestScratchOrgConfig(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_access_token(Command)[source]
test_active(Command)[source]
test_can_delete(Command)[source]
test_choose_devhub(Command)[source]
test_choose_devhub__service_not_configured(Command)[source]
test_create_org(Command)[source]
test_create_org_command_error(Command)[source]
test_create_org_no_config_file(Command)[source]
test_create_org_uses_org_def_email(Command)[source]
test_days(Command)[source]
test_days_alive(Command)[source]
test_days_default(Command)[source]
test_delete_org(Command)[source]
test_delete_org_error(Command)[source]
test_delete_org_not_created(Command)[source]
test_email_address_from_config(Command)[source]
test_email_address_from_git(Command)[source]
test_email_address_not_present(Command)[source]
test_expired(Command)[source]
test_expires(Command)[source]
test_force_refresh_oauth_token(Command)[source]
test_force_refresh_oauth_token_error(Command)[source]
test_format_days(Command)[source]
test_generate_password(Command)[source]
test_generate_password_failed(Command)[source]
test_generate_password_skips_if_failed(Command)[source]
test_instance_url(Command)[source]
test_org_id_from_config(Command)[source]
test_org_id_from_scratch_info(Command)[source]
test_password_from_config(Command)[source]
test_password_from_scratch_info(Command)[source]
test_refresh_oauth_token(Command)[source]
test_scratch_info(Command)[source]
test_scratch_info_command_error(Command)[source]
test_scratch_info_memoized(Command)[source]
test_scratch_info_non_json_response(Command)[source]
test_scratch_info_password_from_config(Command)[source]
test_scratch_info_username_not_found(Command)[source]
test_user_id_from_config(Command)[source]
test_user_id_from_org(Command)[source]
test_username_from_scratch_info(Command)[source]
class cumulusci.core.tests.test_exceptions.TestExceptions(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_ApexCompilationException_str()[source]
test_ApexException()[source]
class cumulusci.core.tests.test_flowrunner.AbstractFlowCoordinatorTest[source]

Bases: object

setUp()[source]
classmethod setUpClass()[source]
class cumulusci.core.tests.test_flowrunner.FullParseTestFlowCoordinator(methodName='runTest')[source]

Bases: cumulusci.core.tests.test_flowrunner.AbstractFlowCoordinatorTest, unittest.case.TestCase

test_each_flow()[source]
class cumulusci.core.tests.test_flowrunner.PreflightFlowCoordinatorTest(methodName='runTest')[source]

Bases: cumulusci.core.tests.test_flowrunner.AbstractFlowCoordinatorTest, unittest.case.TestCase

test_run()[source]
class cumulusci.core.tests.test_flowrunner.SimpleTestFlowCoordinator(methodName='runTest')[source]

Bases: cumulusci.core.tests.test_flowrunner.AbstractFlowCoordinatorTest, unittest.case.TestCase

Tests the expectations of a BaseFlow caller

test_from_steps()[source]
test_get_summary()[source]
test_get_summary__multiple_sources()[source]
test_get_summary__substeps()[source]
test_init()[source]
test_init__bad_classpath()[source]
test_init__nested_options()[source]
test_init__no_steps_in_config()[source]
test_init__options()[source]

A flow can accept task options and pass them to the task.

test_init__task_not_found()[source]

A flow with reference to a task that doesn’t exist in the project will throw a TaskNotFoundError

test_init_ambiguous_step()[source]
test_init_old_format()[source]
test_init_org_updates_keychain()[source]
test_init_recursive_flow()[source]
test_run__nested_flow()[source]

Flows can run inside other flows

test_run__nested_flow_2()[source]

Flows can run inside other flows and call other flows

test_run__nested_option_backrefs()[source]
test_run__no_steps()[source]

A flow with no tasks will have no results.

test_run__one_task()[source]

A flow with one task will execute the task

test_run__option_backref_not_found()[source]
test_run__option_backrefs()[source]

A flow’s options reach into return values from other tasks.

test_run__prints_org_id()[source]

A flow with an org prints the org ID

test_run__skip_conditional_step()[source]
test_run__skip_flow_None()[source]
test_run__skip_from_init()[source]

A flow can receive during init a list of tasks to skip

test_run__task_raises_exception_fail()[source]

A flow aborts when a task raises an exception

test_run__task_raises_exception_ignore()[source]

A flow continues when a task configured with ignore_failure raises an exception

class cumulusci.core.tests.test_flowrunner.StepSpecTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_repr()[source]
class cumulusci.core.tests.test_keychain.ProjectKeychainTestMixin(methodName='runTest')[source]

Bases: unittest.case.TestCase

keychain_class

alias of cumulusci.core.keychain.BaseProjectKeychain.BaseProjectKeychain

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_change_key()[source]
test_get_default_org()[source]
test_get_default_org_no_default()[source]
test_get_org_not_found()[source]
test_get_service_not_configured()[source]
test_init()[source]
test_list_orgs()[source]
test_list_orgs_empty()[source]
test_load_scratch_orgs_create_one()[source]
test_load_scratch_orgs_existing_org()[source]
test_load_scratch_orgs_none()[source]
test_set_and_get_org(global_org=False)[source]
test_set_and_get_scratch_org(global_org=False)[source]
test_set_default_org(Command)[source]
test_set_invalid_service(project=False)[source]
test_set_non_existant_service(project=False)[source]
test_set_service_github(project=False)[source]
test_unset_default_org(Command)[source]
class cumulusci.core.tests.test_keychain.TestBaseEncryptedProjectKeychain(methodName='runTest')[source]

Bases: cumulusci.core.tests.test_keychain.ProjectKeychainTestMixin

keychain_class

alias of cumulusci.core.keychain.BaseEncryptedProjectKeychain.BaseEncryptedProjectKeychain

test_decrypt_config__no_config()[source]
test_decrypt_config__no_config_2()[source]
test_get_connected_app()[source]
test_validate_key__not_set()[source]
test_validate_key__wrong_length()[source]
class cumulusci.core.tests.test_keychain.TestBaseProjectKeychain(methodName='runTest')[source]

Bases: cumulusci.core.tests.test_keychain.ProjectKeychainTestMixin

test_convert_connected_app()[source]
test_create_scratch_org()[source]
test_remove_org()[source]
class cumulusci.core.tests.test_keychain.TestEncryptedFileProjectKeychain(methodName='runTest')[source]

Bases: cumulusci.core.tests.test_keychain.ProjectKeychainTestMixin

keychain_class

alias of cumulusci.core.keychain.EncryptedFileProjectKeychain.EncryptedFileProjectKeychain

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_load_file()[source]
test_load_file__global_config()[source]
test_load_files__empty()[source]
test_remove_org()[source]
test_remove_org__global__not_found()[source]
test_remove_org__not_found()[source]
test_set_and_get_org__global_config()[source]
test_set_and_get_org_global()[source]
test_set_service_github_project()[source]
class cumulusci.core.tests.test_keychain.TestEnvironmentProjectKeychain(methodName='runTest')[source]

Bases: cumulusci.core.tests.test_keychain.ProjectKeychainTestMixin

keychain_class

alias of cumulusci.core.keychain.EnvironmentProjectKeychain.EnvironmentProjectKeychain

setUp()[source]

Hook method for setting up the test fixture before exercising it.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

test_get_default_org()[source]
test_get_org()[source]
test_get_org_not_found()[source]
test_list_orgs()[source]
test_list_orgs_empty()[source]
test_load_app()[source]
test_load_scratch_org_config()[source]
test_load_scratch_orgs_create_one()[source]
test_load_scratch_orgs_none()[source]
test_set_and_get_scratch_org()[source]
test_set_default_org()[source]

The EnvironmentProjectKeychain does not persist default org settings

Tests for the PageObjects class

Testing notes:

The PageObjects library uses robot’s BuiltIn library. However, instantiating that will throw an error if done outside the context of a running robot test. To work around that, these tests mock out the _get_context method to fool the BuiltIn library into not complaining.

These tests use two external files in the same directory as this test: FooTestPage.py and BarTestPage.py. FooTestPage has a single keyword, BarTestPage has two.

class cumulusci.core.tests.test_pageobjects.MockGetLibraryInstance[source]

Bases: object

libs = {'SeleniumLibrary': <Mock id='140390791041600'>, 'cumulusci.robotframework.CumulusCI': <cumulusci.robotframework.CumulusCI.CumulusCI object>, 'cumulusci.robotframework.Salesforce': <Mock id='140390791045072'>}
class cumulusci.core.tests.test_pageobjects.TestPageObjects(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_PageObject(get_context_mock, get_library_instance_mock)[source]

Smoke test to make sure the default registry is set up and keywords exist

test_PageObject_registry_with_custom_pageobjects(get_context_mock, get_library_instance_mock)[source]

Verify that custom page objects get added to the registry

test_namespaced_object_name(get_context_mock, get_library_instance_mock)[source]

Verify that the object name is prefixed by the namespace when there’s a namespace

test_non_namespaced_object_name(get_context_mock, get_library_instance_mock)[source]

Verify that the object name is not prefixed by a namespace when there is no namespace

class cumulusci.core.tests.test_salesforce.TestKeyword_breakpoint(methodName='runTest')[source]

Bases: unittest.case.TestCase

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

test_breakpoint(mock_robot_context)[source]

Verify that the keyword doesn’t raise an exception

class cumulusci.core.tests.test_salesforce.TestKeyword_wait_until_salesforce_is_ready(methodName='runTest')[source]

Bases: unittest.case.TestCase

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

test_exception_on_timeout(mock_robot_context)[source]

Verify that we through an appropriate exception after the timeout

test_reload_on_initial_failure(mock_robot_context)[source]

Verify that we attempt a reload when we don’t find the lightning component

test_successful_page_load(mock_robot_context)[source]

Verify that a succesful page load returns no errors

class cumulusci.core.tests.test_salesforce.TestSeleniumLibrary(methodName='runTest')[source]

Bases: unittest.case.TestCase

classmethod setUpClass()[source]

Hook method for setting up class fixture before running tests in the class.

test_init_locators()[source]

Verify that locators are initialized if not passed in

class cumulusci.core.tests.test_salesforce_locators.TestLocators(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_locators_46()[source]

Verify that locators_46 is a superset of the locators_45

This test is far from perfect, but it should at least flag a catastrophic error in how locators for a version augment the locators for previous versions.

Note: this test assumes that locators_46 doesn’t delete any of the keys from 45.

test_locators_in_robot_context(get_latest_api_version)[source]

Verify we can get locators for the current org api version

test_locators_outside_robot_context(builtin_mock)[source]

Verify that we get the latest locators if not running in the context of a robot test

Tests for the CumulusCI task module

class cumulusci.core.tests.test_tasks.TestBaseTaskCallable(methodName='runTest')[source]

Bases: cumulusci.core.tests.utils.MockLoggerMixin, unittest.case.TestCase

Tests for the BaseTask callable interface.

BaseTask is a callable interface BaseTask has return_values and results BaseTask has basic logging

setUp()[source]

Hook method for setting up the test fixture before exercising it.

task_class

alias of cumulusci.core.tasks.BaseTask

test_dynamic_options()[source]

Option values can lookup values from project_config

test_get_return_values()[source]

Callable interface returns retvals

test_get_task_result()[source]

Task results available as an instance member

test_is_retry_valid()[source]
test_no_id_if_run_from_flow()[source]

A salesforce_task will not log the org id if run from a flow

test_option_overrides()[source]
test_poll()[source]
test_poll_action()[source]
test_retry_on_exception()[source]

calling _retry() should call try until the task succeeds.

test_retry_until_too_many()[source]

calling _retry should call try until the retry count is exhausted.

test_run_task()[source]
test_salesforce_task_logs_org_id()[source]

A salesforce_task will also log the org id & username

test_salesforce_task_no_org()[source]
test_task_is_callable()[source]

BaseTask is Callable

test_task_logs_name_not_org()[source]

A task logs the task class name to info (and not creds)

test_try()[source]
test_validates_missing_options()[source]
class cumulusci.core.tests.test_utils.TestDictMerger(methodName='runTest')[source]

Bases: unittest.case.TestCase

some stuff that didnt get covered by usual usage

test_cant_merge_into_dict()[source]
test_cant_merge_nonsense()[source]
test_merge_into_list()[source]
class cumulusci.core.tests.test_utils.TestMergedConfig(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_init()[source]
test_merge_failure()[source]
class cumulusci.core.tests.test_utils.TestUtils(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_decode_to_unicode()[source]
test_parse_datetime()[source]
test_process_bool_arg()[source]
test_process_glob_list_arg()[source]
test_process_list_arg()[source]

Utilities for testing CumulusCI

MockLoggingHandler: a logging handler that we can assert

class cumulusci.core.tests.utils.EnvironmentVarGuard[source]

Bases: collections.abc.MutableMapping

Class to help protect the environment variable properly. Can be used as a context manager.

keys() → a set-like object providing a view on D's keys[source]
set(envvar, value)[source]
unset(envvar)[source]
class cumulusci.core.tests.utils.MockLoggerMixin[source]

Bases: object

classmethod setUpClass()[source]
class cumulusci.core.tests.utils.MockLoggingHandler(*args, **kwargs)[source]

Bases: logging.Handler

Mock logging handler to check for expected logs.

Messages are available from an instance’s messages dict, in order, indexed by a lowercase log level string (e.g., ‘debug’, ‘info’, etc.).

emit(record)[source]

Store a message from record in the instance’s messages dict.

reset()[source]

Reset the handler in TestCase.setUp() to clear the msg list

Module contents