Esempio n. 1
0
 def test_report_fixtures_data_cache(self):
     data_source = self.get_data_source_mock()
     cache = ReportDataCache()
     self._test_report_fixtures_provider(ReportFixturesProviderV1(cache),
                                         'expected_v1_report', data_source)
     self._test_report_fixtures_provider(ReportFixturesProviderV2(cache),
                                         'expected_v2_report', data_source)
     data_source.get_data.assert_called_once()
Esempio n. 2
0
def _get_report_fixture_for_user(domain, report_id, ota_user):
    """
    :param domain: the domain
    :param report_id: the index to the result from get_report_configs()
    :param ota_user: the OTARestoreCommCareUser for which to get the report fixture
    """
    xml = ReportFixturesProviderV1().report_config_to_fixture(
        get_report_configs(domain)[report_id], ota_user)
    return etree.tostring(xml)
Esempio n. 3
0
def _get_cached_report_fixture_for_user(domain, report_id, ota_user,
                                        ls_app_version):
    """
    :param domain: the domain
    :param report_id: the index to the result from get_report_configs()
    :param ota_user: the OTARestoreCommCareUser for which to get the report fixture
    :param ls_app_version: the version of the app ls is on
    """
    [xml] = ReportFixturesProviderV1().report_config_to_fixture(
        get_report_configs(domain, ls_app_version)[report_id], ota_user)
    return etree.tostring(xml)
Esempio n. 4
0
 def test_v1_report_fixtures_provider(self):
     self._test_report_fixtures_provider(ReportFixturesProviderV1(),
                                         'expected_v1_report')