Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
Overlapping merge requests are not only ugly, they could also cause
test failures. Even though both merges separately passed tests, since
the RPM-to-release linking changed the output of release serializer,
tests added in compose/package refactor were broken.
  • Loading branch information
lubomir committed Aug 12, 2015
1 parent 4d13eb9 commit 0c1408c
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions pdc/apps/compose/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,18 @@ def test_get_for_release_to_dict(self):
{'compose': u'compose-1', 'packages': [
{'name': u'bash', 'version': u'1.2.3', 'epoch': 0, 'release': u'4.b1',
'arch': u'x86_64', 'srpm_name': u'bash', 'srpm_nevra': u'bash-0:1.2.3-4.b1.src',
'filename': 'bash-1.2.3-4.b1.x86_64.rpm'}]},
'filename': 'bash-1.2.3-4.b1.x86_64.rpm', 'id': 1,
'linked_composes': ['compose-1', 'compose-2'], 'linked_releases': []}]},
{'compose': u'compose-2', 'packages': [
{'name': u'bash', 'version': u'1.2.3', 'epoch': 0, 'release': u'4.b1',
'arch': u'x86_64', 'srpm_name': u'bash', 'srpm_nevra': u'bash-0:1.2.3-4.b1.src',
'filename': 'bash-1.2.3-4.b1.x86_64.rpm'}]},
'filename': 'bash-1.2.3-4.b1.x86_64.rpm', 'id': 1,
'linked_composes': ['compose-1', 'compose-2'], 'linked_releases': []}]},
{'compose': u'compose-3', 'packages': [
{'name': u'bash', 'version': u'5.6.7', 'epoch': 0, 'release': u'8',
'arch': u'x86_64', 'srpm_name': u'bash', 'srpm_nevra': None,
'filename': 'bash-5.6.7-8.x86_64.rpm'}]}
'filename': 'bash-5.6.7-8.x86_64.rpm', 'id': 2,
'linked_composes': ['compose-3'], 'linked_releases': []}]}
]
self.assertEqual(response.data, expected)

Expand Down Expand Up @@ -275,10 +278,16 @@ def test_previous_compose_has_older_rpm_with_to_dict(self):
response = self.client.get(url, {'to_dict': True})
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data.get('compose'), "compose-2")
self.assertEqual(response.data.get('packages'), [
{'name': u'bash', 'version': u'1.2.3', 'epoch': 0, 'release': u'4.b1',
'arch': u'x86_64', 'srpm_name': u'bash', 'srpm_nevra': u'bash-0:1.2.3-4.b1.src',
'filename': 'bash-1.2.3-4.b1.x86_64.rpm'}])
packages = response.data.get('packages')
self.assertEqual(len(packages), 1)
self.assertItemsEqual(packages[0].pop('linked_composes'), ['compose-1', 'compose-2'])
self.assertEqual(packages[0].pop('linked_releases'), [])
packages[0].pop('id')
self.assertDictEqual(
dict(packages[0]),
{'name': 'bash', 'version': '1.2.3', 'epoch': 0, 'release': '4.b1',
'arch': 'x86_64', 'srpm_name': 'bash', 'srpm_nevra': 'bash-0:1.2.3-4.b1.src',
'filename': 'bash-1.2.3-4.b1.x86_64.rpm'})

def test_same_version_different_arch(self):
"""There is a previous compose with same version of package, but with different RPM.arch."""
Expand Down

0 comments on commit 0c1408c

Please sign in to comment.