onadata.apps.logger.tests.models package

Submodules

onadata.apps.logger.tests.models.test_attachment module

class onadata.apps.logger.tests.models.test_attachment.TestAttachment(methodName='runTest')

Bases: TestBase

setUp()

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

test_create_attachment_with_media_file_length_more_the_100()
test_create_attachment_with_mimetype_more_than_50()
test_create_thumbnails_command()
test_get_original_filename()
test_mimetype()
test_thumbnails()
test_upload_to()

Test that upload to returns the correct path

onadata.apps.logger.tests.models.test_data_view module

onadata.apps.logger.tests.models.test_entity module

Tests for module onadata.apps.logger.models.entity

class onadata.apps.logger.tests.models.test_entity.EntityHistoryTestCase(methodName='runTest')

Bases: TestBase

Tests for model EntityHistory

setUp()

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

test_creation(mock_now)

We can create an EntityHistory

test_optional_fields()

Default for optional fields are correct

class onadata.apps.logger.tests.models.test_entity.EntityTestCase(methodName='runTest')

Bases: TestBase

Tests for model Entity

setUp()

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

test_creation(mock_now)

We can create an Entity

test_entity_list_uuid_unique()

entity_list and uuid are unique together

test_hard_delete(mock_dec)

Hard deleting updates dataset info

test_optional_fields()

Defaults for optional fields are correct

test_soft_delete(mock_now, mock_dec)

Soft delete works

onadata.apps.logger.tests.models.test_entity_list module

Tests for module onadata.apps.logger.models.entity_list

class onadata.apps.logger.tests.models.test_entity_list.EntityListTestCase(methodName='runTest')

Bases: TestBase

Tests for model EntityList

setUp() None

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

test_creation(mock_now)

We can create an EntityList

test_defaults()

Defaults for optional fields are correct

test_hard_delete()

Hard delete removes consumers’ metadata

test_max_name_length()

Field name should not exceed 255 characters

test_name_project_unique_together()

No duplicate name and project allowed

test_permissions_applied_async(mock_set_perms)

Permissions are applied asynchronously

test_properties()

Returns the correct dataset properties

test_soft_delete()

EntityList is soft deleted

onadata.apps.logger.tests.models.test_follow_up_form module

Tests for module onadata.apps.logger.models.follow_up_form

class onadata.apps.logger.tests.models.test_follow_up_form.FollowUpFormTestCase(methodName='runTest')

Bases: TestBase

Tests for model FollowUpForm

setUp()

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

test_creation(mock_now)

We can create a FollowUpForm

test_no_duplicate_entity_list_xform()

No duplicates allowed for existing entity_list and xform

test_optional_fields()

Defaults for optional fields correct

Related names for foreign keys work

onadata.apps.logger.tests.models.test_instance module

Test Instance model.

class onadata.apps.logger.tests.models.test_instance.TestInstance(methodName='runTest')

Bases: TestBase

setUp()

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

test_create_entity()

An Entity is created from a submission

test_create_entity_exists()

Attempting to create an Entity that already exists fails

test_create_entity_false()

An Entity is not created if create_if evaluates to false

test_create_entity_true()

An Entity is created if create_if evaluates to true

test_entity_create_update_true()

Both create_if and update_if evaluate to true

test_get_id_string_from_xml_str()
test_instance_json_updated_on_review()
Test:
-no review comment or status on instance json

before submission review

-instance json review fields update on review save -instance review methods

test_instances_with_geopoints_in_repeats()
test_instances_with_malformed_geopoints_dont_trigger_value_error(mock_get_values_matching_key)
test_json_stores_user_attribute(mock_time)
test_light_tasks_synchronous(mock_json_async)

Metadata from light tasks is always processed synchronously

test_numeric_checker_with_negative_integer_values()
test_parse_numbers()

Integers and decimals are parsed correctly

test_query_data_sort()
test_query_filter_by_datetime_field()
test_query_filter_by_integer()
test_registration_form_inactive()

When the RegistrationForm is inactive, Entity should not be created

test_retrieve_non_existent_submission_review()

Test fetch submission review for instance when a submission review was never created for the submission

test_set_instances_with_geopoints_on_submission_false()
test_set_instances_with_geopoints_on_submission_true()
test_stores_json()
test_submission_review_enabled_entity_create()

Submission review disables automatic creation of Entity

test_submission_review_enabled_entity_update()

Submission review disables automatic update of an Entity

Only an approved Instance will update an Entity

test_update_entity()

An Entity is updated from a submission

test_update_entity_false()

Entity not updated if update_if evaluates to false

test_update_entity_label()

An Entity label is updated from a submission

test_update_entity_true()

Entity updated if update_if evaluates to true

test_update_entity_via_instance_update()

Entity is updated if Instance from updating form is updated

test_updates_json_date_modified_on_save()

_date_modified in json field is updated on save

onadata.apps.logger.tests.models.test_note module

Note Model Tests Module

class onadata.apps.logger.tests.models.test_note.TestNote(methodName='runTest')

Bases: TestBase

TestNote Class

test_no_created_by()
Test:
  • Returns empty string when created_by is None

onadata.apps.logger.tests.models.test_project_invitation module

Tests for ProjectInvitation model

class onadata.apps.logger.tests.models.test_project_invitation.ProjectInvitationTestCase(methodName='runTest')

Bases: TestBase

Tests for ProjectInvitation model

setUp() None

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

test_accept()

Calling accept method works correctly

test_creation()

We can create a ProjectInvitation object

test_defaults()

Defaults for optional fields are correct

test_revoke()

Calling revoke method works correctly

onadata.apps.logger.tests.models.test_registration_form module

Tests for module onadata.apps.logger.models.registration_form

class onadata.apps.logger.tests.models.test_registration_form.RegistrationFormTestCase(methodName='runTest')

Bases: TestBase

Tests for model RegistrationForm

setUp()

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

test_creation(mock_now)

We can create a RegistrationForm

test_entity_list_xform_unique()

No duplicates allowed for existing entity_list and xform

test_get_save_to()

Method get_save_to works correctly

test_optional_fields()

Defaults for optional fields correct

onadata.apps.logger.tests.models.test_submission_review module

Submission Review Model Tests Module

class onadata.apps.logger.tests.models.test_submission_review.TestSubmissionReview(methodName='runTest')

Bases: TestBase

TestSubmissionReview Class

test_entity_created()

Entity is created for when submission is approved

test_entity_created_approved_edit()

Entity created when submission review changes to Approved

test_entity_created_approved_only()

Entity is only created if status is Approved

test_note_text_property_method()
Test :
  • note_text property

  • get_note_text method

test_set_deleted()
Test :
  • set_deleted method

onadata.apps.logger.tests.models.test_xform module

test_xform module

class onadata.apps.logger.tests.models.test_xform.TestXForm(methodName='runTest')

Bases: TestBase

Test XForm model.

test_check_xform_uuid()

Test check_xform_uuid(new_uuid).

test_get_survey_element()

Test XForm.get_survey_element()

test_id_string_length()

Test Xform.id_string cannot store more than 100 chars

test_id_string_max_length_on_soft_delete()

Test XForm soft delete with long id_string or sms_id_string

test_multiple_model_nodes()

Test XForm.set_uuid_in_xml() function is able to handle a form that has field named model which may match the XForm’s top level node also named model.

test_restore_deleted(mock_clear_project_cache)

Deleted XForm can be restored

test_restore_deleted_merged_xform(mock_clear_project_cache)

Deleted merged XForm can be restored

test_set_title_unicode_error()

Test title in xml does not error on unicode title.

test_soft_delete()

Test XForm soft delete.

test_submission_count()

Test submission count does not include deleted submissions.

test_version_length()

Test Xform.version can store more than 12 chars

Module contents