def test_dump_to_params(self): for hash_type, source_types in hashes_test_cases.items(): params = Mock() dh = DlrnHash(source=source_types['object']['valid']) dh.dump_to_params(params) if hash_type == "commitdistro": self.assertEqual(params.commit_hash, dh.commit_hash) self.assertEqual(params.distro_hash, dh.distro_hash) elif hash_type == "aggregate": self.assertEqual(params.aggregate_hash, dh.aggregate_hash) self.assertEqual(params.timestamp, dh.timestamp)
def test_fetch_promotions_from_hash(self, fetch_hashes_mock, mock_log_debug): params = copy.deepcopy(self.client.hashes_params) param_dlrn_hash = \ DlrnHash(source=hashes_test_cases['commitdistro']['dict']['valid']) self.client.fetch_promotions_from_hash(param_dlrn_hash, count=1) param_dlrn_hash.dump_to_params(params) fetch_hashes_mock.assert_has_calls([ mock.call(params, count=1) ]) mock_log_debug.assert_has_calls([ mock.call("Fetching promotion hashes from hash %s", param_dlrn_hash) ])