[Reproducible-commits] [debbindiff] 06/06: Add tests for ISO9660 comparator

Jérémy Bobbio lunar at moszumanska.debian.org
Wed Jun 24 17:37:05 UTC 2015


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch master
in repository debbindiff.

commit 1f63b83f19c318246dd5f846adb53986edf5410a
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Wed Jun 24 17:31:26 2015 +0000

    Add tests for ISO9660 comparator
---
 tests/comparators/test_iso9660.py          |  50 +++++++++++++++++++++++++++++
 tests/data/iso9660_content_expected_diff   |   9 ++++++
 tests/data/iso9660_rockridge_expected_diff |  10 ++++++
 tests/data/test1.iso                       | Bin 0 -> 360448 bytes
 tests/data/test2.iso                       | Bin 0 -> 360448 bytes
 5 files changed, 69 insertions(+)

diff --git a/tests/comparators/test_iso9660.py b/tests/comparators/test_iso9660.py
new file mode 100644
index 0000000..8693f39
--- /dev/null
+++ b/tests/comparators/test_iso9660.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# debbindiff: highlight differences between two builds of Debian packages
+#
+# Copyright © 2015 Jérémy Bobbio <lunar at debian.org>
+#
+# debbindiff is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# debbindiff is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with debbindiff.  If not, see <http://www.gnu.org/licenses/>.
+
+import codecs
+import os.path
+import shutil
+import pytest
+from debbindiff.comparators.iso9660 import compare_iso9660_files
+
+TEST_FILE1_PATH = os.path.join(os.path.dirname(__file__), '../data/test1.iso') 
+TEST_FILE2_PATH = os.path.join(os.path.dirname(__file__), '../data/test2.iso') 
+
+def test_no_differences():
+    differences = compare_iso9660_files(TEST_FILE1_PATH, TEST_FILE1_PATH)
+    assert len(differences) == 0
+
+ at pytest.fixture
+def differences():
+    return compare_iso9660_files(TEST_FILE1_PATH, TEST_FILE2_PATH)[0].details # skip container with path
+
+def test_iso9660_content(differences):
+    expected_diff = open(os.path.join(os.path.dirname(__file__), '../data/iso9660_content_expected_diff')).read()
+    assert differences[0].unified_diff == expected_diff
+
+def test_iso9660_rockridge(differences):
+    expected_diff = open(os.path.join(os.path.dirname(__file__), '../data/iso9660_rockridge_expected_diff')).read()
+    assert differences[1].unified_diff == expected_diff
+
+def test_compressed_files(differences):
+    assert differences[2].source1 == '/text'
+    assert differences[2].source2 == '/text'
+    expected_diff = open(os.path.join(os.path.dirname(__file__), '../data/text_ascii_expected_diff')).read()
+    assert differences[2].unified_diff == expected_diff
diff --git a/tests/data/iso9660_content_expected_diff b/tests/data/iso9660_content_expected_diff
new file mode 100644
index 0000000..b5831f9
--- /dev/null
+++ b/tests/data/iso9660_content_expected_diff
@@ -0,0 +1,9 @@
+@@ -1,7 +1,7 @@
+ 
+ Directory listing of /
+ d---------   0    0    0            2048 Jun 24 2015 [     23 02]  . 
+ d---------   0    0    0            2048 Jun 24 2015 [     23 02]  .. 
+ ----------   0    0    0               0 Jun 24 2015 [     25 00]  LINK.;1 
+ ----------   0    0    0               0 Jun 24 2015 [     25 00]  NULL.;1 
+-----------   0    0    0             446 Jun 24 2015 [     25 00]  TEXT.;1 
++----------   0    0    0             671 Jun 24 2015 [     25 00]  TEXT.;1 
diff --git a/tests/data/iso9660_rockridge_expected_diff b/tests/data/iso9660_rockridge_expected_diff
new file mode 100644
index 0000000..d0a7614
--- /dev/null
+++ b/tests/data/iso9660_rockridge_expected_diff
@@ -0,0 +1,10 @@
+@@ -1,7 +1,7 @@
+ 
+ Directory listing of /
+ drwxr-xr-x   2 1750 1750            2048 Jun 24 2015 [     23 02]  . 
+ drwxr-xr-x   2 1750 1750            2048 Jun 24 2015 [     23 02]  .. 
+-lrwxrwxrwx   1 1750 1750               0 Jun 24 2015 [     25 00]  link -> broken
++lrwxrwxrwx   1 1750 1750               0 Jun 24 2015 [     25 00]  link -> really-broken
+ crw-r--r--   1    0    0               0 Jun 24 2015 [     25 00]  null 
+--rw-r--r--   1 1750 1750             446 Jun 24 2015 [     25 00]  text 
++-rw-r--r--   1 1750 1750             671 Jun 24 2015 [     25 00]  text 
diff --git a/tests/data/test1.iso b/tests/data/test1.iso
new file mode 100644
index 0000000..f4c36a2
Binary files /dev/null and b/tests/data/test1.iso differ
diff --git a/tests/data/test2.iso b/tests/data/test2.iso
new file mode 100644
index 0000000..cae1ddc
Binary files /dev/null and b/tests/data/test2.iso differ

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/debbindiff.git



More information about the Reproducible-commits mailing list