def _test_get_test_list(self, input_data, expected_data): input_results = self._make_test_json(input_data) expected_results = JSON_RESULTS_TEST_LIST_TEMPLATE.replace( "{[TESTDATA_TESTS]}", simplejson.dumps(expected_data, separators=(',', ':'))) actual_results = JsonResults.get_test_list(self._builder, input_results) self.assertEquals(actual_results, expected_results)
def _test_merge(self, aggregated_data, incremental_data, expected_data, max_builds=jsonresults.JSON_RESULTS_MAX_BUILDS): aggregated_results = self._make_test_json(aggregated_data) incremental_results = self._make_test_json(incremental_data) merged_results = JsonResults.merge(self._builder, aggregated_results, incremental_results, max_builds, sort_keys=True) if expected_data: expected_results = self._make_test_json(expected_data) self.assertEquals(merged_results, expected_results) else: self.assertFalse(merged_results)
def _test_merge(self, aggregated_data, incremental_data, expected_data, max_builds=jsonresults.JSON_RESULTS_MAX_BUILDS): aggregated_results = self._make_test_json(aggregated_data) incremental_results = self._make_test_json(incremental_data) merged_results = JsonResults.merge(self._builder, aggregated_results, incremental_results, max_builds, sort_keys=True) if expected_data: expected_results = self._make_test_json(expected_data) self.assertEqual(merged_results, expected_results) else: self.assertFalse(merged_results)
def _test_get_test_list(self, input_data, expected_data): input_results = self._make_test_json(input_data) json_tests = [] for test in expected_data: json_tests.append("\"" + test + "\":{}") expected_results = (JSON_RESULTS_PREFIX + JSON_RESULTS_TEST_LIST_TEMPLATE.replace("[TESTDATA_TESTS]", ",".join(json_tests)) + JSON_RESULTS_SUFFIX) actual_results = JsonResults.get_test_list(self._builder, input_results) self.assertEquals(actual_results, expected_results)
def _test_merge(self, aggregated_data, incremental_data, expected_data): aggregated_results = self._make_test_json(aggregated_data) incremental_results = self._make_test_json(incremental_data) merged_results = JsonResults.merge(self._builder, aggregated_results, incremental_results, sort_keys=True) if expected_data: expected_results = self._make_test_json(expected_data) self.assertEquals(merged_results, expected_results) else: self.assertFalse(merged_results)
def _test_get_test_list(self, input_data, expected_data): input_results = self._make_test_json(input_data) json_tests = [] for test in expected_data: json_tests.append("\"" + test + "\":{}") expected_results = (JSON_RESULTS_PREFIX + JSON_RESULTS_TEST_LIST_TEMPLATE.replace( "[TESTDATA_TESTS]", ",".join(json_tests)) + JSON_RESULTS_SUFFIX) actual_results = JsonResults.get_test_list(self._builder, input_results) self.assertEquals(actual_results, expected_results)
def test_strip_prefix_suffix(self): json = "['contents']" self.assertEqual(JsonResults._strip_prefix_suffix("ADD_RESULTS(" + json + ");"), json) self.assertEqual(JsonResults._strip_prefix_suffix(json), json)
def _test_get_test_list(self, input_data, expected_data): input_results = self._make_test_json(input_data) expected_results = JSON_RESULTS_TEST_LIST_TEMPLATE.replace("{[TESTDATA_TESTS]}", simplejson.dumps(expected_data, separators=(',', ':'))) actual_results = JsonResults.get_test_list(self._builder, input_results) self.assertEquals(actual_results, expected_results)