onadata.libs.tests.utils package¶
Submodules¶
onadata.libs.tests.utils.test_api_export_tools module¶
onadata.libs.tests.utils.test_async_status module¶
onadata.libs.tests.utils.test_backup_tools module¶
onadata.libs.tests.utils.test_chart_tools module¶
- class onadata.libs.tests.utils.test_chart_tools.TestChartTools(methodName='runTest')¶
Bases:
TestBase
- mock_get_abbreviated_xpath()¶
- setUp()¶
Hook method for setting up the test fixture before exercising it.
- test_build_chart_category_field_group_by_category_field_in_group()¶
- test_build_chart_data_calculate_field_group_by_category_field()¶
- test_build_chart_data_cannot_group_by_field()¶
- test_build_chart_data_for_category_field_group_by_category_field()¶
- test_build_chart_data_for_field_on_duration()¶
- test_build_chart_data_for_field_on_grouped_field()¶
- test_build_chart_data_for_field_on_select_one()¶
- test_build_chart_data_for_field_on_submission_time()¶
- test_build_chart_data_for_field_on_submitted_by()¶
- test_build_chart_data_for_field_on_submitted_by_group_by()¶
- test_build_chart_data_for_field_with_language()¶
- test_build_chart_data_for_field_with_language_on_non_lang_field()¶
- test_build_chart_data_for_fields_with_accents()¶
- test_build_chart_data_for_fields_with_apostrophies()¶
Test that apostrophes are escaped before they are sent to the database.
If the not escaped a django.db.utils.ProgrammingError would be raised.
- test_build_chart_data_for_group_by_submitted_by()¶
- test_build_chart_data_for_non_numeric_field_group_by_two_fields()¶
- test_build_chart_data_for_numeric_field_group_by_category_field()¶
- test_build_chart_data_for_numeric_field_group_by_two_fields()¶
- test_build_chart_data_output()¶
- test_build_chart_data_strips_none_from_dates()¶
- test_build_chart_data_with_field_name_with_lengh_65()¶
- test_build_chart_data_with_nonexisting_field_xpath()¶
- test_get_choice_label_for_multi_select()¶
- test_get_choice_label_for_multi_select_with_spaces()¶
Select Multiple Fields with names with spaces will NEVER match their labels
- test_get_choice_label_when_label_not_in_choice_list()¶
- test_get_choice_label_with_list_label()¶
- test_get_choice_label_with_single_select()¶
- test_select_one_choices()¶
- test_select_one_choices_group_by()¶
- class onadata.libs.tests.utils.test_chart_tools.TestChartUtilFunctions(methodName='runTest')¶
Bases:
TestCase
- test_calculate_range_on_normal_values()¶
- test_calculate_range_when_page_is_beyond_limit()¶
- test_flatten_multiple_dict_into_one()¶
- test_raise_value_error_if_bad_time_zone()¶
- test_raise_value_error_if_no_match()¶
- test_utc_time_string_for_javascript()¶
- onadata.libs.tests.utils.test_chart_tools.find_field_by_name(xform, field_name)¶
- onadata.libs.tests.utils.test_chart_tools.find_field_by_xpath(xform, field_xpath)¶
onadata.libs.tests.utils.test_csv_builder module¶
Test CSVDataFrameBuilder
- class onadata.libs.tests.utils.test_csv_builder.TestCSVDataFrameBuilder(methodName='runTest')¶
Bases:
TestBase
CSVDataFrameBuilder test class
- setUp()¶
Hook method for setting up the test fixture before exercising it.
- test_csv_column_indices_in_groups_within_repeats()¶
Test CSV column indices in groups within repeats.
- test_csv_columns_for_gps_within_groups()¶
Test CSV columns for GPS fields within groups.
- test_csv_dataframe_export_to()¶
Test CSVDataFrameBuilder.export_to().
- test_csv_export()¶
Test CSV export.
- test_csv_export_extra_columns()¶
Test CSV export EXTRA_COLUMNS
- test_csv_export_remove_group_name()¶
Test CSV export with remove_group_name option.
- test_csv_export_with_labels()¶
Test CSV export with labels.
- test_csv_export_with_labels_only()¶
Test CSV export with labels only.
- test_export_data_for_xforms_with_newer_submissions()¶
Test xform schema for form with no submission is successfully exported
- test_export_data_for_xforms_without_submissions()¶
Test xform schema for form with no submission is successfully exported
- test_format_mongo_data_for_csv()¶
Test format mongo data for CSV.
- test_get_prefix_from_xpath()¶
Test get_prefix_from_xpath(xpath) function.
- test_index_tag_replacement()¶
Test that the default index tags are correctly replaced by an underscore
- test_multiple_repeats_column_order()¶
Test the order of the columns in a multiple repeats form export
- test_no_split_select_multiples()¶
Test select multiples are not split within repeats.
- test_remove_dups_from_list_maintain_order()¶
Test remove_dups_from_list_maintain_order().
- test_remove_group_name_for_gps_within_groups()¶
Test gps CSV export with remove_group_name option.
- test_repeat_child_name_matches_repeat()¶
ParsedInstance.to_dict creates a list within a repeat if a child has the same name as the repeat. This test makes sure that doesnt happen
- test_select_multiples_grouped_repeating_w_split()¶
Select multiple choices within group within repeat with split
- test_select_multiples_grouped_repeating_wo_split()¶
Select multiple choices within group within repeat without split
- test_show_choice_labels()¶
Test show_choice_labels=true for select one questions.
- test_show_choice_labels_multi_language()¶
Test show_choice_labels=true for select one questions - multi language form.
- test_show_choice_labels_multi_language_1()¶
Test show_choice_labels=true for select one questions - multi language form selected language.
- test_show_choice_labels_select_multiple()¶
Test show_choice_labels=true for select multiple questions.
- test_show_choice_labels_select_multiple_1()¶
Test show_choice_labels=true, split_select_multiples=true and value_select_multiples=true for select multiple questions.
- test_show_choice_labels_select_multiple_1_language()¶
Test show_choice_labels=true, split_select_multiples=true and value_select_multiples=true for select multiple questions - multi language form.
- test_show_choice_labels_select_multiple_2()¶
Test show_choice_labels=true, split_select_multiples=true, binary_select_multiples=true for select multiple questions.
- test_show_choice_labels_select_multiple_3()¶
Test show_choice_labels=true, split_select_multiples=true, binary_select_multiples=false for select multiple questions.
- test_show_choice_labels_select_multiple_language()¶
Test show_choice_labels=true for select multiple questions - multi language form.
- test_split_gps_fields()¶
Test GPS fields data are split into latitude, longitude, altitude, and precision segments.
- test_split_gps_fields_within_repeats()¶
Test GPS fields data is split within repeats.
- test_split_select_multiples()¶
Test select multiples choices are split.
- test_split_select_multiples_values()¶
Test select multiples choices are split and their values as the data.
- test_split_select_multiples_with_randomize()¶
Test select multiples choices are split with the randomize option true.
- test_split_select_multiples_within_repeats()¶
Test select multiples choices are split within repeats in CSV exports.
- test_unicode_export()¶
Test write_to_csv() with unicode characters.
- test_windows_excel_compatible_csv_export()¶
Test window excel compatible CSV export.
- onadata.libs.tests.utils.test_csv_builder.xls_filepath_from_fixture_name(fixture_name)¶
Return an xls file path at tests/fixtures/[fixture]/fixture.xls
- onadata.libs.tests.utils.test_csv_builder.xml_inst_filepath_from_fixture_name(fixture_name, instance_name)¶
Returns the path to a fixture given fixture_name and instance_name.