From 956f74358b1ee7a586327e02fae11b73e56c36bd Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Mon, 15 Dec 2025 23:37:08 +0300 Subject: [PATCH] Add tests for other mode indicators --- tests/fixtures/ubuntu-24.04/sha256sum.json | 1 + tests/fixtures/ubuntu-24.04/sha256sum.out | 1 + tests/fixtures/ubuntu-24.04/shasum.json | 1 + tests/fixtures/ubuntu-24.04/shasum.out | 2 ++ tests/test_hashsum.py | 24 ++++++++++++++++++++++ 5 files changed, 29 insertions(+) create mode 100644 tests/fixtures/ubuntu-24.04/sha256sum.json create mode 100644 tests/fixtures/ubuntu-24.04/sha256sum.out create mode 100644 tests/fixtures/ubuntu-24.04/shasum.json create mode 100644 tests/fixtures/ubuntu-24.04/shasum.out diff --git a/tests/fixtures/ubuntu-24.04/sha256sum.json b/tests/fixtures/ubuntu-24.04/sha256sum.json new file mode 100644 index 00000000..a773c0b9 --- /dev/null +++ b/tests/fixtures/ubuntu-24.04/sha256sum.json @@ -0,0 +1 @@ +[{"filename": "openssl-3.6.0.tar.gz", "mode": "*", "hash": "b6a5f44b7eb69e3fa35dbf15524405b44837a481d43d81daddde3ff21fcbb8e9"}] \ No newline at end of file diff --git a/tests/fixtures/ubuntu-24.04/sha256sum.out b/tests/fixtures/ubuntu-24.04/sha256sum.out new file mode 100644 index 00000000..51c8d1c7 --- /dev/null +++ b/tests/fixtures/ubuntu-24.04/sha256sum.out @@ -0,0 +1 @@ +b6a5f44b7eb69e3fa35dbf15524405b44837a481d43d81daddde3ff21fcbb8e9 *openssl-3.6.0.tar.gz \ No newline at end of file diff --git a/tests/fixtures/ubuntu-24.04/shasum.json b/tests/fixtures/ubuntu-24.04/shasum.json new file mode 100644 index 00000000..3846e740 --- /dev/null +++ b/tests/fixtures/ubuntu-24.04/shasum.json @@ -0,0 +1 @@ +[{"filename": "out.txt", "mode": "U", "hash": "6fe4d572948d4c132d1b1b0ab91e89de4be01efd"}, {"filename": "out.txt", "mode": "^", "hash": "68382a729a930a2219f0bd10c5c4d61eec856a96"}] \ No newline at end of file diff --git a/tests/fixtures/ubuntu-24.04/shasum.out b/tests/fixtures/ubuntu-24.04/shasum.out new file mode 100644 index 00000000..280821ec --- /dev/null +++ b/tests/fixtures/ubuntu-24.04/shasum.out @@ -0,0 +1,2 @@ +6fe4d572948d4c132d1b1b0ab91e89de4be01efd Uout.txt +68382a729a930a2219f0bd10c5c4d61eec856a96 ^out.txt \ No newline at end of file diff --git a/tests/test_hashsum.py b/tests/test_hashsum.py index 882cb1d5..27094789 100644 --- a/tests/test_hashsum.py +++ b/tests/test_hashsum.py @@ -18,6 +18,12 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/sha384sum.out'), 'r', encoding='utf-8') as f: centos_7_7_sha384sum = f.read() + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/sha384sum.out'), 'r', encoding='utf-8') as f: + ubuntu_24_04_sha256sum = f.read() + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/sha384sum.out'), 'r', encoding='utf-8') as f: + ubuntu_24_04_shasum = f.read() + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/md5.out'), 'r', encoding='utf-8') as f: osx_10_14_6_md5 = f.read() @@ -34,6 +40,12 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/sha384sum.json'), 'r', encoding='utf-8') as f: centos_7_7_sha384sum_json = json.loads(f.read()) + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-24.04/sha256sum.json'), 'r', encoding='utf-8') as f: + ubuntu_24_04_sha256sum_json = json.loads(f.read()) + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/ubuntu-24.04/shasum.json'), 'r', encoding='utf-8') as f: + ubuntu_24_04_shasum_json = json.loads(f.read()) + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/osx-10.14.6/md5.json'), 'r', encoding='utf-8') as f: osx_10_14_6_md5_json = json.loads(f.read()) @@ -65,6 +77,18 @@ class MyTests(unittest.TestCase): """ self.assertEqual(jc.parsers.hashsum.parse(self.centos_7_7_sha384sum, quiet=True), self.centos_7_7_sha384sum_json) + def test_sha256sum_ubuntu_24_04(self): + """ + Test 'sha256sum' on Ubuntu 24.04 + """ + self.assertEqual(jc.parsers.hashsum.parse(self.ubuntu_24_04_sha256sum, quiet=True), self.ubuntu_24_04_sha256sum_json) + + def test_shasum_ubuntu_24_04(self): + """ + Test 'shasum' on Ubuntu 24.04 + """ + self.assertEqual(jc.parsers.hashsum.parse(self.ubuntu_24_04_shasum, quiet=True), self.ubuntu_24_04_shasum_json) + def test_md5_osx_10_14_6(self): """ Test 'md5' on OSX 10.14.6