]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume tests.util add binary verification tests
authorAlfredo Deza <adeza@redhat.com>
Mon, 6 Nov 2017 14:43:58 +0000 (09:43 -0500)
committerAlfredo Deza <adeza@redhat.com>
Mon, 13 Nov 2017 15:20:12 +0000 (10:20 -0500)
Signed-off-by: Alfredo Deza <adeza@redhat.com>
(cherry picked from commit 827aa57557561355dd4068e26801b5f1ed62f295)

src/ceph-volume/ceph_volume/tests/util/test_system.py

index c7ccb7d21469a46212920836a065e5957ba45a40..56b88b3f4aef731e40e3eeb7a25442b9f9096697 100644 (file)
@@ -143,3 +143,14 @@ class TestGetMounts(object):
         monkeypatch.setattr(os.path, 'exists', lambda x: False if x == '/dev/sda1' else True)
         result = system.get_mounts()
         assert result.get('/dev/sda1') is None
+
+
+class TestIsBinary(object):
+
+    def test_is_binary(self, tmpfile):
+        binary_path = tmpfile(contents='asd\n\nlkjh\x00')
+        assert system.is_binary(binary_path)
+
+    def test_is_not_binary(self, tmpfile):
+        binary_path = tmpfile(contents='asd\n\nlkjh0')
+        assert system.is_binary(binary_path) is False