def test_set_creation(repo): a = artifact_record(id='foo') b = artifact_record(id='blah') repo.put(a) repo.put(b) artifact_set = r.create_set([a, b], labels='myset') assert repo.get_set_by_labels('myset') == artifact_set assert repo.get_set_by_id(artifact_set.id) == artifact_set
def test_set_creation_with_labels_dict(repo): a = artifact_record(id='foo') b = artifact_record(id='blah') repo.put(a) repo.put(b) labels = {'name': 'myset', 'foo': 54, 'bar': 23} artifact_set = r.create_set([a, b], labels=labels) assert repo.get_set_by_labels(labels) == artifact_set assert repo.get_set_by_id(artifact_set.id) == artifact_set
def test_set_renaming(repo): a = artifact_record(id='foo') b = artifact_record(id='blah') repo.put(a) repo.put(b) named_set = r.create_set([a, b], 'foobar') assert repo.get_set_by_labels('foobar') == named_set renamed_set = r.label_set(named_set, 'baz') # we don't delete the old one assert repo.get_set_by_labels('foobar') == named_set assert repo.get_set_by_labels('baz') == renamed_set