def __init__(self, *builds): self.builds = list(builds) self.environments = OrderedDict() self.all_environments = set() self.results = OrderedDict() Build.prefetch_related(self.builds) self.__extract_results__()
def test_important_metadata_keys_with_spaces(self): project = Project(important_metadata_keys='my key\n') build = Build(project=project) m = { 'my key': 'my value', } with patch('squad.core.models.Build.metadata', m): self.assertEqual({'my key': 'my value'}, build.important_metadata)
def test_important_metadata(self): project = Project(important_metadata_keys='foo1\nfoo2\nmissingkey\n') build = Build(project=project) m = { 'foo1': 'bar1', 'foo2': 'bar2', 'foo3': 'bar3', } with patch('squad.core.models.Build.metadata', m): self.assertEqual({'foo1': 'bar1', 'foo2': 'bar2'}, build.important_metadata) self.assertEqual(True, build.has_extra_metadata)
def test_important_metadata_default(self): project = Project() build = Build(project=project) with patch('squad.core.models.Build.metadata', {'foo': 'bar'}): self.assertEqual({'foo': 'bar'}, build.important_metadata) self.assertEqual({}, build.non_important_metadata)