Drop custom ANY object
There is already one such thing in mock library. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
2f54745715
commit
562b770b8d
@ -803,7 +803,7 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
repo.get_modifyrepo_cmd.mock_calls,
|
||||||
[mock.call(repodata_dir, ANY, compress_type="gz", mdtype="modules")],
|
[mock.call(repodata_dir, mock.ANY, compress_type="gz", mdtype="modules")],
|
||||||
)
|
)
|
||||||
|
|
||||||
@unittest.skipUnless(Modulemd is not None, 'Skipped test, no module support.')
|
@unittest.skipUnless(Modulemd is not None, 'Skipped test, no module support.')
|
||||||
@ -856,22 +856,10 @@ class TestCreateVariantRepo(PungiTestCase):
|
|||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
repo.get_modifyrepo_cmd.mock_calls,
|
repo.get_modifyrepo_cmd.mock_calls,
|
||||||
[mock.call(repodata_dir, ANY, compress_type="gz", mdtype="modules")],
|
[mock.call(repodata_dir, mock.ANY, compress_type="gz", mdtype="modules")],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ANYSingleton(object):
|
|
||||||
"""An object that is equal to anything."""
|
|
||||||
def __eq__(self, another):
|
|
||||||
return True
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return u'ANY'
|
|
||||||
|
|
||||||
|
|
||||||
ANY = ANYSingleton()
|
|
||||||
|
|
||||||
|
|
||||||
class TestGetProductIds(PungiTestCase):
|
class TestGetProductIds(PungiTestCase):
|
||||||
def mock_get(self, filenames):
|
def mock_get(self, filenames):
|
||||||
def _mock_get(scm, dest):
|
def _mock_get(scm, dest):
|
||||||
@ -913,7 +901,7 @@ class TestGetProductIds(PungiTestCase):
|
|||||||
|
|
||||||
get_productids_from_scm(self.compose)
|
get_productids_from_scm(self.compose)
|
||||||
|
|
||||||
self.assertEqual(get_dir_from_scm.call_args_list, [mock.call(cfg, ANY)])
|
self.assertEqual(get_dir_from_scm.call_args_list, [mock.call(cfg, mock.ANY)])
|
||||||
self.assertProductIds({
|
self.assertProductIds({
|
||||||
'Client': ['amd64'],
|
'Client': ['amd64'],
|
||||||
'Everything': ['amd64', 'x86_64'],
|
'Everything': ['amd64', 'x86_64'],
|
||||||
@ -934,7 +922,7 @@ class TestGetProductIds(PungiTestCase):
|
|||||||
|
|
||||||
get_productids_from_scm(self.compose)
|
get_productids_from_scm(self.compose)
|
||||||
|
|
||||||
self.assertEqual(get_dir_from_scm.call_args_list, [mock.call(cfg, ANY)])
|
self.assertEqual(get_dir_from_scm.call_args_list, [mock.call(cfg, mock.ANY)])
|
||||||
self.assertProductIds({
|
self.assertProductIds({
|
||||||
'Server': ['amd64', 'x86_64'],
|
'Server': ['amd64', 'x86_64'],
|
||||||
})
|
})
|
||||||
@ -953,7 +941,7 @@ class TestGetProductIds(PungiTestCase):
|
|||||||
with self.assertRaises(RuntimeError) as ctx:
|
with self.assertRaises(RuntimeError) as ctx:
|
||||||
get_productids_from_scm(self.compose)
|
get_productids_from_scm(self.compose)
|
||||||
|
|
||||||
self.assertEqual(get_dir_from_scm.call_args_list, [mock.call(cfg, ANY)])
|
self.assertEqual(get_dir_from_scm.call_args_list, [mock.call(cfg, mock.ANY)])
|
||||||
self.assertRegexpMatches(
|
self.assertRegexpMatches(
|
||||||
str(ctx.exception),
|
str(ctx.exception),
|
||||||
r'No product certificate found \(arch: amd64, variant: (Everything|Client)\)')
|
r'No product certificate found \(arch: amd64, variant: (Everything|Client)\)')
|
||||||
@ -976,7 +964,7 @@ class TestGetProductIds(PungiTestCase):
|
|||||||
with self.assertRaises(RuntimeError) as ctx:
|
with self.assertRaises(RuntimeError) as ctx:
|
||||||
get_productids_from_scm(self.compose)
|
get_productids_from_scm(self.compose)
|
||||||
|
|
||||||
self.assertEqual(get_dir_from_scm.call_args_list, [mock.call(cfg, ANY)])
|
self.assertEqual(get_dir_from_scm.call_args_list, [mock.call(cfg, mock.ANY)])
|
||||||
self.assertRegexpMatches(
|
self.assertRegexpMatches(
|
||||||
str(ctx.exception),
|
str(ctx.exception),
|
||||||
'Multiple product certificates found.+')
|
'Multiple product certificates found.+')
|
||||||
|
Loading…
Reference in New Issue
Block a user