Skip to content
Snippets Groups Projects
Commit ad2c3498 authored by Stefano Zacchiroli's avatar Stefano Zacchiroli
Browse files

refactor CLI tests to avoid duplicate assertion pairs

parent 07208f04
No related branches found
No related tags found
No related merge requests found
...@@ -33,9 +33,7 @@ class TestIdentify(DataMixin, unittest.TestCase): ...@@ -33,9 +33,7 @@ class TestIdentify(DataMixin, unittest.TestCase):
path = os.path.join(self.tmpdir_name, filename) path = os.path.join(self.tmpdir_name, filename)
result = self.runner.invoke(cli.identify, result = self.runner.invoke(cli.identify,
['--type', 'content', path]) ['--type', 'content', path])
self.assertPidOK(result,
self.assertEqual(result.exit_code, 0)
self.assertEqual(result.output.split()[0],
'swh:1:cnt:' + hash_to_hex(content['sha1_git'])) 'swh:1:cnt:' + hash_to_hex(content['sha1_git']))
def test_directory_id(self): def test_directory_id(self):
...@@ -44,9 +42,7 @@ class TestIdentify(DataMixin, unittest.TestCase): ...@@ -44,9 +42,7 @@ class TestIdentify(DataMixin, unittest.TestCase):
path = os.path.join(self.tmpdir_name, b'sample-folder') path = os.path.join(self.tmpdir_name, b'sample-folder')
result = self.runner.invoke(cli.identify, result = self.runner.invoke(cli.identify,
['--type', 'directory', path]) ['--type', 'directory', path])
self.assertPidOK(result,
self.assertEqual(result.exit_code, 0)
self.assertEqual(result.output.split()[0],
'swh:1:dir:e8b0f1466af8608c8a3fb9879db172b887e80759') 'swh:1:dir:e8b0f1466af8608c8a3fb9879db172b887e80759')
def test_symlink(self): def test_symlink(self):
...@@ -85,9 +81,7 @@ class TestIdentify(DataMixin, unittest.TestCase): ...@@ -85,9 +81,7 @@ class TestIdentify(DataMixin, unittest.TestCase):
result = self.runner.invoke(cli.identify, result = self.runner.invoke(cli.identify,
['--type', 'content', '--no-filename', ['--type', 'content', '--no-filename',
path]) path])
self.assertPidOK(result,
self.assertEqual(result.exit_code, 0)
self.assertEqual(result.output.rstrip(),
'swh:1:cnt:' + hash_to_hex(content['sha1_git'])) 'swh:1:cnt:' + hash_to_hex(content['sha1_git']))
def test_auto_id(self): def test_auto_id(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment