From: Alfredo Deza Date: Mon, 6 Nov 2017 14:43:58 +0000 (-0500) Subject: ceph-volume tests.util add binary verification tests X-Git-Tag: v12.2.2~23^2~32 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c9308af91a322f92ab7d1f45a423b2a94f64c429;p=ceph.git ceph-volume tests.util add binary verification tests Signed-off-by: Alfredo Deza (cherry picked from commit 827aa57557561355dd4068e26801b5f1ed62f295) --- diff --git a/src/ceph-volume/ceph_volume/tests/util/test_system.py b/src/ceph-volume/ceph_volume/tests/util/test_system.py index c7ccb7d21469..56b88b3f4aef 100644 --- a/src/ceph-volume/ceph_volume/tests/util/test_system.py +++ b/src/ceph-volume/ceph_volume/tests/util/test_system.py @@ -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