onadata.apps.api.tests package

Subpackages

Submodules

onadata.apps.api.tests.mocked_data module

onadata.apps.api.tests.test_tasks module

Tests for module onadata.apps.api.tasks

class onadata.apps.api.tests.test_tasks.DeleteXFormSubmissionsAsyncTestCase(methodName='runTest')

Bases: TestBase

Tests for delete_xform_submissions_async

setUp()

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

test_connection_error(mock_retry, mock_delete)

We retry calls if ConnectionError is raised

test_database_error(mock_retry, mock_delete)

We retry calls if DatabaseError is raised

test_delete(mock_delete)

Submissions are deleted

test_user_id_invalid(mock_logger, mock_delete)

Invalid user_id is handled

test_xform_id_invalid(mock_logger, mock_delete)

Invalid xform_id is handled

class onadata.apps.api.tests.test_tasks.RegenerateFormInstanceJsonTestCase(methodName='runTest')

Bases: TestBase

Tests for regenerate_form_instance_json

test_already_generated()

Regeneration fails for a form whose regeneration has already been done

test_form_id_invalid(mock_log_exception)

An invalid xform_id is handled

test_json_overriden()

Existing json is overriden

test_regenerates_instances_json()

Regenerates instances json

class onadata.apps.api.tests.test_tasks.SendProjectInivtationEmailAsyncTestCase(methodName='runTest')

Bases: TestBase

Tests for send_project_invitation_email_async

setUp() None

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

test_sends_email(mock_send)

Test email is sent

class onadata.apps.api.tests.test_tasks.ShareProjectAsyncTestCase(methodName='runTest')

Bases: TestBase

Tests for share_project_async

setUp()

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

test_connection_error(mock_retry, mock_share)

We retry calls if ConnectionError is raised

test_database_error(mock_retry, mock_share)

We retry calls if DatabaseError is raised

test_invalid_project_id(mock_log)

Invalid projecct_id is handled

test_operation_error(mock_retry, mock_share)

We retry calls if OperationError is raised

test_remove()

User is removed from project

test_share()

Project is shared with user

onadata.apps.api.tests.test_tasks.set_cache_for_org(org, request)

Utility to set org cache

onadata.apps.api.tests.test_tools module

Tests for module onadata.apps.api.tools

class onadata.apps.api.tests.test_tools.AddUserToOrganizationTestCase(methodName='runTest')

Bases: TestBase

Tests for add_user_to_organization

setUp() None

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

test_add_owner()

Owner added to org and projects shared

test_non_owner()

Non-owners add to org and projects shared

Non-owners should be assigned default project permissions

test_project_created_by_manager()

A manager is assigned manager role on projects they created

test_role_none()

role param is None or not provided

class onadata.apps.api.tests.test_tools.InvalidateXFormListCacheTestCase(methodName='runTest')

Bases: TestBase

Tests for invalidate_xform_list_cache

setUp()

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

test_cache_invalidated()

Cache invalidated for xform and project

Module contents