Skip to content

Commit

Permalink
tests back to 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
matijakolaric committed Apr 17, 2021
1 parent afba214 commit 637445f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
6 changes: 3 additions & 3 deletions music_publisher/tests/CW210001052_DMP.V21
Expand Up @@ -7,8 +7,8 @@ ACK0000000300000000201805160910510000100000003NWRTHREE
ACK0000000400000000201805160910510000100000004NWRX DMP000025 20180607NP
GRT000010000005000000007
GRHISW0000202.100020180607
ISW0000000000000000MUSIC PUB CARTOONS DMP000001 00000000 UNC000000Y MOD UNSUNS N00000000000 N
ISW0000000100000000MUSIC PUB CARTOONS DMP000001 T123456789500000000 UNC000000Y MOD UNSUNS N00000000000 N
ISW0000000200000000MUSIC PUB CARTOONS DMP000001 T123456789400000000 UNC000000Y MOD UNSUNS N00000000000 N
ISW0000000000000000MUSIC PUB CARTOONS MK000001 T322123423400000000 UNC000000Y MOD UNSUNS N00000000000 N
ISW0000000100000000MUSIC PUB CARTOONS MK000001 T123456789300000000 UNC000000Y MOD UNSUNS N00000000000 N
ISW0000000200000000MUSIC PUB CARTOONS MK000001 T123456789400000000 UNC000000Y MOD UNSUNS N00000000000 N
GRT000020000003000000003
TRL000010000008000000014
34 changes: 27 additions & 7 deletions music_publisher/tests/tests.py
Expand Up @@ -1026,8 +1026,11 @@ def test_ack_import_and_work_filters(self):
data.update({'acknowledgement_file': mockfile})
response = self.client.post(url, data, follow=False)
self.assertEqual(response.status_code, 302)
self.assertEqual(
music_publisher.models.ACKImport.objects.first().report, '')
self.assertIn(
'A different ISWC exists for work MK000001: THE MODIFIED WORK '
'(SMITH): T3221234234 (old) vs T1234567893 (new).',
music_publisher.models.ACKImport.objects.first().report
)

"""This file has also ISWC codes."""
mock = StringIO()
Expand All @@ -1044,7 +1047,7 @@ def test_ack_import_and_work_filters(self):
# At this point, there is a different ISWC in one of the works
response = self.client.post(url, data, follow=False)
messages = list(get_messages(response.wsgi_request))
self.assertEqual(len(messages), 2)
self.assertEqual(len(messages), 3)
self.assertIn(
'Conflicting ISWCs found for work',
str(messages[0]),
Expand Down Expand Up @@ -1112,7 +1115,10 @@ def test_ack_import_and_work_filters(self):
url = base_url + '?in_cwr=Y&ack_society=21&has_iswc=Y&has_rec=Y'
response = self.client.get(url, follow=False)
self.assertEqual(response.status_code, 200)
url = base_url + '?in_cwr=N&ack_status=RA&has_iswc=N&has_rec=N'
url = base_url + '?in_cwr=N&ack_society=21&ack_status=RA&has_iswc=N&has_rec=N'
response = self.client.get(url, follow=False)
self.assertEqual(response.status_code, 200)
url = base_url + '?ack_status=RA&has_iswc=N&has_rec=N'
response = self.client.get(url, follow=False)
self.assertEqual(response.status_code, 200)

Expand Down Expand Up @@ -1364,6 +1370,20 @@ def test_data_import_and_royalty_calculations(self):
# The file must be processed in under 10 seconds
self.assertLess((time_after - time_before).total_seconds(), 15)

# TEST BAD
with open(TEST_CWR2_FILENAME) as csvfile:
mock = StringIO()
mock.write(csvfile.read())
mockfile = InMemoryUploadedFile(
mock, 'statement_file', 'statement.csv',
'text', 0, None)
url = reverse('royalty_calculation')
response = self.client.get(url)
data = get_data_from_response(response)
data.update({'in_file': mockfile})
response = self.client.post(url, data, follow=False)


@override_settings(REQUIRE_SAAN=False, REQUIRE_PUBLISHER_FEE=False)
def test_bad_data_import(self):
"""Test bad data import."""
Expand Down Expand Up @@ -1912,9 +1932,9 @@ def test_work(self):
ACK0000000400000000201805160910510000100000004NWRX DMP000025 20180607NP
GRT000010000005000000007
GRHISW0000202.100020180607
ISW0000000000000000MUSIC PUB CARTOONS DMP000001 00000000 UNC000000Y MOD UNSUNS N00000000000 N
ISW0000000100000000MUSIC PUB CARTOONS DMP000001 T123456789500000000 UNC000000Y MOD UNSUNS N00000000000 N
ISW0000000200000000MUSIC PUB CARTOONS DMP000001 T123456789400000000 UNC000000Y MOD UNSUNS N00000000000 N
ISW0000000000000000MUSIC PUB CARTOONS MK000001 T322123423400000000 UNC000000Y MOD UNSUNS N00000000000 N
ISW0000000100000000MUSIC PUB CARTOONS MK000001 T123456789300000000 UNC000000Y MOD UNSUNS N00000000000 N
ISW0000000200000000MUSIC PUB CARTOONS XX000001 T123456789400000000 UNC000000Y MOD UNSUNS N00000000000 N
GRT000020000003000000003
TRL000010000008000000014"""

Expand Down

0 comments on commit 637445f

Please sign in to comment.