onadata.apps.viewer.tests package

Submodules

onadata.apps.viewer.tests.export_helpers module

onadata.apps.viewer.tests.export_helpers.viewer_fixture_path(*args)

onadata.apps.viewer.tests.test_attachment_url module

Test attachments.

class onadata.apps.viewer.tests.test_attachment_url.TestAttachmentUrl(methodName='runTest')

Bases: TestBase

Test attachments.

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_attachment_has_mimetype()
test_attachment_not_found()
test_attachment_url()
test_attachment_url_has_azure_sas_token(mock_media_url)

Test attachment url has azure sas token

test_attachment_url_no_redirect()
test_attachment_url_w_media_id()

Test attachment url with attachment id

test_attachment_url_w_media_id_no_redirect()

Test attachment url with attachment id no redirect

onadata.apps.viewer.tests.test_charts_view module

class onadata.apps.viewer.tests.test_charts_view.TestChartsView(methodName='runTest')

Bases: TestBase

setUp()

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

test_chart_view_with_bad_lang_param()
test_chart_view_with_lang_param()
test_charts_view_returns_200()

onadata.apps.viewer.tests.test_data_view module

class onadata.apps.viewer.tests.test_data_view.TestDataView(methodName='runTest')

Bases: TestBase

setUp()

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

test_allow_if_shared()
test_allow_if_user_given_permission()
test_data_view()
test_data_view_with_username_and_id_string_in_uppercase()
test_disallow_if_user_permission_revoked()
test_restrict_for_anon()
test_restrict_for_not_owner()

onadata.apps.viewer.tests.test_export_list module

Test export list view.

class onadata.apps.viewer.tests.test_export_list.TestDataExportURL(methodName='runTest')

Bases: TestBase

setUp()

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

test_csv_export_url()
test_csv_export_url_without_records()
test_csv_zip_export_url()
test_sav_zip_export_long_variable_length()
test_sav_zip_export_url()
test_xlsx_export_url()
class onadata.apps.viewer.tests.test_export_list.TestExportList(methodName='runTest')

Bases: TestBase

Test export list view.

setUp()

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

test_csv_export_list()
test_csv_zip_export_list()
test_export_data_with_unavailable_id_string()
test_external_export_list()
test_external_export_list_no_template()
test_kml_export_list()
test_sav_zip_export_list()
test_unauthorised_users_cannot_export_form_data()
test_unsupported_type_export()
test_xls_export_not_supported()
test_xlsx_export_list()
test_zip_export_list()

onadata.apps.viewer.tests.test_exports module

Test exports

class onadata.apps.viewer.tests.test_exports.TestExports(methodName='runTest')

Bases: TestBase

class FakeDate

Bases: datetime

classmethod now(tz=None)

Returns new datetime object representing current time local to tz.

tz

Timezone object.

If no tz is specified, uses local timezone.

setUp()

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

test_404_on_export_io_error()

Test that we return a 404 when the response_with_mimetype_and_name encounters an IOError

test_add_index_to_filename()
test_all_keys_cleaned_of_slashes()
test_auto_export_if_none_exists()
test_column_header_delimiter_export_option()
test_create_export()
test_create_export_url()
test_create_export_url_with_unavailable_id_string()
test_create_external_export_url()
test_create_external_export_url_with_non_existing_export_id(mock_404)
test_create_external_export_without_template()
test_create_xlsx_export_non_existent_id()
test_csv_http_response()
test_csv_without_na_values()
test_delete_export_url()
test_delete_file_on_export_delete()
test_delete_oldest_export_on_limit()
test_deleted_submission_not_in_export()
test_dict_to_joined_export_notes()
test_dict_to_joined_export_works()
test_direct_export_returns_newest_export_if_not_updated_since()
test_dont_auto_export_if_exports_exist()
test_duplicate_export_filename_is_renamed()
test_edited_submissions_in_exports()
test_export_download_url()
test_export_ids_dont_have_comma_separation()

It seems using {{ }} to output numbers greater than 1000 formats the number with a thousand separator

test_export_progress_output()
test_export_progress_updates()

Test that after generate_export is called, we change out state to pending and after its complete, we change it to complete, if we fail between the two, updates, we have failed

test_exports_outdated_considers_pending_exports()
test_exports_outdated_doesnt_consider_failed_exports()
test_generate_csv_zip_export()
test_graceful_exit_on_export_delete_if_file_doesnt_exist()
test_invalid_export_type()
test_last_submission_time_empty()
test_last_submission_time_on_export()
test_query_data_with_invalid_args()
test_responses_for_empty_exports()

csv exports for forms without submissions should return xform column headers in export.

test_split_select_multiple_export_option()
test_unique_xls_sheet_name()

onadata.apps.viewer.tests.test_instance_view module

class onadata.apps.viewer.tests.test_instance_view.TestInstanceView(methodName='runTest')

Bases: TestBase

setUp()

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

test_allow_if_shared()
test_allow_if_user_given_permission()
test_disallow_if_user_permission_revoked()
test_instance_view()
test_restrict_for_anon()
test_restrict_for_not_owner()

onadata.apps.viewer.tests.test_kml_export module

class onadata.apps.viewer.tests.test_kml_export.TestKMLExport(methodName='runTest')

Bases: TestBase

test_kml_export()

onadata.apps.viewer.tests.test_map_view module

class onadata.apps.viewer.tests.test_map_view.TestMapView(methodName='runTest')

Bases: TestCase

test_jsonform_url()

onadata.apps.viewer.tests.test_parsed_instance module

class onadata.apps.viewer.tests.test_parsed_instance.TestParsedInstance(methodName='runTest')

Bases: TestBase

test_get_where_clause_or_date_range()

OR operation get_where_clause with date range

test_get_where_clause_with_integer()
test_get_where_clause_with_json_query()
test_get_where_clause_with_string_query()
test_invalid_date_format()

Inavlid date format is handled

test_parse_sort_fields_function()

Test that the _parse_sort_fields function works as intended

test_parse_where_clause_simple_query()
test_parse_where_with_date_value()
test_parse_where_with_null_value()
test_retrieve_records_based_on_form_verion()
test_retrieve_records_using_list_of_queries()

onadata.apps.viewer.tests.test_stats_table_view module

class onadata.apps.viewer.tests.test_stats_table_view.TestStatsTableView(methodName='runTest')

Bases: TestBase

setUp()

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

test_view_returns_200()

onadata.apps.viewer.tests.test_tasks module

class onadata.apps.viewer.tests.test_tasks.TestExportTasks(methodName='runTest')

Bases: TestBase

setUp()

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

test_create_async()
test_delete_expired_failed_exports()
test_mark_expired_pending_exports_as_failed()

Module contents