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.surveyor_registration module¶
onadata.apps.viewer.tests.test_attachment_url module¶
onadata.apps.viewer.tests.test_charts_view module¶
onadata.apps.viewer.tests.test_data_view module¶
-
class
onadata.apps.viewer.tests.test_data_view.
TestDataView
(methodName='runTest')¶ Bases:
onadata.apps.main.tests.test_base.TestBase
-
setUp
()¶
-
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_builder module¶
-
class
onadata.apps.viewer.tests.test_export_builder.
TestExportBuilder
(methodName='runTest')¶ Bases:
onadata.apps.main.tests.test_base.TestBase
-
data
= [{'tel/telLg==office': '020123456', 'age': 35, 'name': 'Abe', 'children': [{'children/fav_colors': 'red blue', 'children/iceLg==creams': 'vanilla chocolate', 'children/name': 'Mike', 'children/age': 5, 'children/cartoons': [{'children/cartoons/why': 'Tom is silly', 'children/cartoons/name': 'Tom & Jerry'}, {'children/cartoons/why': u'I like bam bam\u0107', 'children/cartoons/name': 'Flinstones'}]}, {'children/cartoons': [], 'children/name': 'John', 'children/age': 2}, {'children/cartoons': [{'children/cartoons/why': "He's so funny", 'children/cartoons/name': 'Shrek'}, {'children/cartoons/characters': [{'children/cartoons/characters/good_or_evil': 'good', 'children/cartoons/characters/name': 'Dee Dee'}, {'children/cartoons/characters/good_or_evil': 'evil', 'children/cartoons/characters/name': 'Dexter'}], 'children/cartoons/why': 'He thinks hes smart', 'children/cartoons/name': "Dexter's Lab"}], 'children/name': 'Imora', 'children/age': 3}]}, {'children': []}]¶
-
data_utf8
= [{'tel/telLg==office': '020123456', 'age': 35, 'childrenLg==info': [{'childrenLg==info/nameLg==first': 'Mike', 'childrenLg==info/fav_colors': u'red\u2019s blue\u2019s', 'childrenLg==info/cartoons': [{'childrenLg==info/cartoons/name': 'Tom & Jerry', 'childrenLg==info/cartoons/why': 'Tom is silly'}, {'childrenLg==info/cartoons/name': 'Flinstones', 'childrenLg==info/cartoons/why': u'I like bam bam\u0107'}], 'childrenLg==info/age': 5, 'childrenLg==info/ice_creams': 'vanilla chocolate'}], 'name': 'Abe'}]¶
-
long_survey_data
= [{'childrens_survey_with_a_very_lo': [{'childrens_survey_with_a_very_lo/fav_colors': 'red blue', 'childrens_survey_with_a_very_lo/age': 5, 'childrens_survey_with_a_very_lo/name': 'Mike', 'childrens_survey_with_a_very_lo/cartoons': [{'childrens_survey_with_a_very_lo/cartoons/why': 'Tom is silly', 'childrens_survey_with_a_very_lo/cartoons/name': 'Tom & Jerry'}, {'childrens_survey_with_a_very_lo/cartoons/why': u'I like bam bam\u0107', 'childrens_survey_with_a_very_lo/cartoons/name': 'Flinstones'}]}, {'childrens_survey_with_a_very_lo/age': 2, 'childrens_survey_with_a_very_lo/name': 'John', 'childrens_survey_with_a_very_lo/cartoons': []}, {'childrens_survey_with_a_very_lo/age': 3, 'childrens_survey_with_a_very_lo/name': 'Imora', 'childrens_survey_with_a_very_lo/cartoons': [{'childrens_survey_with_a_very_lo/cartoons/why': "He's so funny", 'childrens_survey_with_a_very_lo/cartoons/name': 'Shrek'}, {'childrens_survey_with_a_very_lo/cartoons/why': 'He thinks hes smart', 'childrens_survey_with_a_very_lo/cartoons/name': "Dexter's Lab", 'childrens_survey_with_a_very_lo/cartoons/characters': [{'children/cartoons/characters/good_or_evil': 'good', 'childrens_survey_with_a_very_lo/cartoons/characters/name': 'Dee Dee'}, {'children/cartoons/characters/good_or_evil': 'evil', 'childrens_survey_with_a_very_lo/cartoons/characters/name': 'Dexter'}]}]}], 'age': 35, 'name': 'Abe'}]¶
-
test_build_sections_from_survey
()¶
-
test_child_record_parent_table_is_updated_when_sheet_is_renamed
()¶
-
test_convert_types
()¶
-
test_csv_export_with_swahili_labels
()¶
-
test_decode_fields_names_encoded_for_mongo
()¶
-
test_decode_mongo_encoded_section_names
()¶
-
test_delimiter_replacement_works_existing_fields
()¶
-
test_delimiter_replacement_works_for_generated_gps_fields
()¶
-
test_delimiter_replacement_works_generated_multi_select_fields
()¶
-
test_generate_field_title
()¶
-
test_generate_field_title_truncated_titles
()¶
-
test_generate_field_title_truncated_titles_select_multiple
()¶
-
test_generation_of_gps_fields_works
()¶
-
test_generation_of_mongo_encoded_fields_works
()¶
-
test_generation_of_multi_selects_works
()¶
-
test_get_valid_sheet_name_catches_duplicates
()¶
-
test_get_valid_sheet_name_catches_long_duplicate_names
()¶
-
test_get_valid_sheet_name_catches_long_names
()¶
-
test_select_multiples_choices
()¶
-
test_select_multiples_choices_with_choice_filter
()¶
-
test_split_gps_components_works
()¶
-
test_split_gps_components_works_when_gps_data_is_blank
()¶
-
test_split_select_multiples_works
()¶
-
test_split_select_multiples_works_when_data_is_blank
()¶
-
test_split_select_mutliples_works_with_int_value_in_row
()¶
-
test_string_to_date_with_xls_validation
()¶
-
test_to_sav_export
()¶
-
test_to_sav_export_language
()¶
-
test_to_sav_export_with_labels
()¶
-
test_to_xls_export_generates_valid_sheet_names
()¶
-
test_to_xls_export_respects_custom_field_delimiter
()¶
-
test_to_xls_export_works
()¶
-
test_type_conversion
()¶
-
test_xls_convert_dates_before_1900
()¶
-
test_xls_export_remove_group_name
()¶
-
test_xls_export_with_english_labels
()¶
-
test_xls_export_with_hxl_adds_extra_row
()¶
-
test_xls_export_with_labels
()¶
-
test_xls_export_with_labels_only
()¶
-
test_xls_export_with_swahili_labels
()¶
-
test_xls_export_works_with_unicode
()¶
-
test_zipped_csv_export_remove_group_name
()¶ cvs writer doesnt handle unicode we we have to encode to ascii
-
test_zipped_csv_export_with_labels
()¶ cvs writer doesnt handle unicode we we have to encode to ascii
-
test_zipped_csv_export_with_labels_only
()¶ cvs writer doesnt handle unicode we we have to encode to ascii
-
test_zipped_csv_export_works
()¶
-
test_zipped_csv_export_works_with_unicode
()¶ cvs writer doesnt handle unicode we we have to encode to ascii
-
onadata.apps.viewer.tests.test_export_list module¶
-
class
onadata.apps.viewer.tests.test_export_list.
TestDataExportURL
(methodName='runTest')¶ Bases:
onadata.apps.main.tests.test_base.TestBase
-
setUp
()¶
-
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_xls_export_url
()¶
-
-
class
onadata.apps.viewer.tests.test_export_list.
TestExportList
(methodName='runTest')¶ Bases:
onadata.apps.main.tests.test_base.TestBase
-
setUp
()¶
-
test_csv_export_list
()¶
-
test_csv_zip_export_list
()¶
-
test_external_export_list
()¶
-
test_external_export_list_no_template
()¶
-
test_kml_export_list
()¶
-
test_sav_zip_export_list
()¶
-
test_unsupported_type_export
()¶
-
test_xls_export_list
()¶
-
test_zip_export_list
()¶
-
onadata.apps.viewer.tests.test_exports module¶
-
class
onadata.apps.viewer.tests.test_exports.
TestExports
(methodName='runTest')¶ Bases:
onadata.apps.main.tests.test_base.TestBase
-
class
FakeDate
¶ Bases:
datetime.datetime
-
classmethod
now
(tz=None)¶
-
classmethod
-
TestExports.
setUp
()¶
-
TestExports.
test_404_on_export_io_error
()¶ Test that we return a 404 when the response_with_mimetype_and_name encounters an IOError
-
TestExports.
test_add_index_to_filename
()¶
-
TestExports.
test_all_keys_cleaned_of_slashes
()¶
-
TestExports.
test_auto_export_if_none_exists
()¶
-
TestExports.
test_column_header_delimiter_export_option
()¶
-
TestExports.
test_create_export
()¶
-
TestExports.
test_create_export_url
()¶
-
TestExports.
test_create_external_export_url
()¶
-
TestExports.
test_create_external_export_url_with_non_existing_export_id
(*args, **keywargs)¶
-
TestExports.
test_create_external_export_without_template
()¶
-
TestExports.
test_create_xls_export_non_existent_id
()¶
-
TestExports.
test_csv_http_response
()¶
-
TestExports.
test_csv_without_na_values
()¶
-
TestExports.
test_delete_export_url
()¶
-
TestExports.
test_delete_file_on_export_delete
()¶
-
TestExports.
test_delete_oldest_export_on_limit
()¶
-
TestExports.
test_deleted_submission_not_in_export
()¶
-
TestExports.
test_dict_to_joined_export_notes
()¶
-
TestExports.
test_dict_to_joined_export_works
()¶
-
TestExports.
test_direct_export_returns_newest_export_if_not_updated_since
()¶
-
TestExports.
test_dont_auto_export_if_exports_exist
()¶
-
TestExports.
test_duplicate_export_filename_is_renamed
(*args, **keywargs)¶
-
TestExports.
test_edited_submissions_in_exports
()¶
-
TestExports.
test_export_download_url
()¶
-
TestExports.
test_export_ids_dont_have_comma_separation
()¶ It seems using {{ }} to output numbers greater than 1000 formats the number with a thousand separator
-
TestExports.
test_export_progress_output
()¶
-
TestExports.
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
-
TestExports.
test_exports_outdated_considers_pending_exports
()¶
-
TestExports.
test_exports_outdated_doesnt_consider_failed_exports
()¶
-
TestExports.
test_generate_csv_zip_export
()¶
-
TestExports.
test_graceful_exit_on_export_delete_if_file_doesnt_exist
()¶
-
TestExports.
test_invalid_export_type
()¶
-
TestExports.
test_last_submission_time_empty
()¶
-
TestExports.
test_last_submission_time_on_export
()¶
-
TestExports.
test_query_data_with_invalid_args
()¶
-
TestExports.
test_responses_for_empty_exports
()¶
-
TestExports.
test_split_select_multiple_export_option
()¶
-
TestExports.
test_unique_xls_sheet_name
()¶
-
class
onadata.apps.viewer.tests.test_instance_view module¶
-
class
onadata.apps.viewer.tests.test_instance_view.
TestInstanceView
(methodName='runTest')¶ Bases:
onadata.apps.main.tests.test_base.TestBase
-
setUp
()¶
-
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:
onadata.apps.main.tests.test_base.TestBase
-
test_kml_export
()¶
-
onadata.apps.viewer.tests.test_map_view module¶
onadata.apps.viewer.tests.test_parsed_instance module¶
-
class
onadata.apps.viewer.tests.test_parsed_instance.
TestParsedInstance
(methodName='runTest')¶ Bases:
onadata.apps.main.tests.test_base.TestBase
-
test_get_where_clause_with_integer
()¶
-
test_get_where_clause_with_json_query
()¶
-
test_get_where_clause_with_string_query
()¶
-
onadata.apps.viewer.tests.test_stats_table_view module¶
-
class
onadata.apps.viewer.tests.test_stats_table_view.
TestStatsTableView
(methodName='runTest')¶ Bases:
onadata.apps.main.tests.test_base.TestBase
-
setUp
()¶
-
test_view_returns_200
()¶
-
onadata.apps.viewer.tests.test_tasks module¶
-
class
onadata.apps.viewer.tests.test_tasks.
TestExportTasks
(methodName='runTest')¶ Bases:
onadata.apps.main.tests.test_base.TestBase
-
setUp
()¶
-
test_create_async
()¶
-
onadata.apps.viewer.tests.test_viewer_tools module¶
-
class
onadata.apps.viewer.tests.test_viewer_tools.
TestViewerTools
(methodName='runTest')¶ Bases:
onadata.apps.main.tests.test_base.TestBase
-
test_export_def_from_filename
()¶
-
test_get_client_ip
()¶
-
test_get_enketo_defaults_with_multiple_params
()¶
-
test_get_enketo_defaults_with_non_existent_field
()¶
-
test_get_enketo_defaults_with_right_xform
()¶
-
test_get_enketo_defaults_without_vars
()¶
-
test_get_form
()¶
-