diff --git a/src/ceph-volume/ceph_volume/tests/devices/simple/test_scan.py b/src/ceph-volume/ceph_volume/tests/devices/simple/test_scan.py new file mode 100644 index 00000000000..56489f751c1 --- /dev/null +++ b/src/ceph-volume/ceph_volume/tests/devices/simple/test_scan.py @@ -0,0 +1,19 @@ +from ceph_volume.devices.simple import scan + + +class TestGetContentst(object): + + def test_multiple_lines_are_left_as_is(self, tmpfile): + magic_file = tmpfile(contents='first\nsecond\n') + scanner = scan.Scan([]) + assert scanner.get_contents(magic_file) == 'first\nsecond\n' + + def test_extra_whitespace_gets_removed(self, tmpfile): + magic_file = tmpfile(contents='first ') + scanner = scan.Scan([]) + assert scanner.get_contents(magic_file) == 'first' + + def test_single_newline_values_are_trimmed(self, tmpfile): + magic_file = tmpfile(contents='first\n') + scanner = scan.Scan([]) + assert scanner.get_contents(magic_file) == 'first'