Skip to content

Commit

Permalink
test: Update tests for change in compile_release signature
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Oct 28, 2024
1 parent dfad02b commit 3d80733
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tests/processors/test_compile_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ class CompileReleaseTests(TransactionTestCase):

@patch("process.management.commands.release_compiler.create_note")
def test_nonexistent_input(self, create_note):
release = compile_release(3, "nonexistent")
collection = Collection.objects.get(pk=3)

release = compile_release(collection, "nonexistent")

self.assertIsNone(release)
create_note.assert_called_once_with(
Expand All @@ -22,19 +24,24 @@ def test_nonexistent_input(self, create_note):
)

def test_already_compiled(self):
collection = Collection.objects.get(pk=3)

with self.assertRaises(AlreadyExists) as e:
compile_release(3, "ocds-px0z7d-17998-18005-1")
compile_release(collection, "ocds-px0z7d-17998-18005-1")

self.assertEqual(
str(e.exception),
"Compiled release ocds-px0z7d-17998-18005-1 (id: 45) already exists in collection "
"portugal_releases:2020-12-29 09:22:08 (id: 3)",
)

def test_happy_day(self):
collection = Collection.objects.get(pk=3)
ocid = "ocds-px0z7d-5052-5001-1"
compiled_release = CompiledRelease.objects.get(collection_id=3, ocid=ocid)
compiled_release.collection_file_item.collection_file.delete()
release = compile_release(3, ocid)

release = compile_release(collection, ocid)

self.assertEqual(release.ocid, ocid)
self.assertEqual(release.collection.id, 3)
Expand Down

0 comments on commit 3d80733

Please sign in to comment.