ceph-volume tests.simple add checks for get_contents in scan

Signed-off-by: Alfredo Deza <adeza@redhat.com>
This commit is contained in:
Alfredo Deza 2017-11-06 10:06:02 -05:00
parent 827aa57557
commit 647bfe0883

View File

@ -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'