Better blockfix replace

This commit is contained in:
Daniel A Wozniak 2018-08-21 23:09:00 +00:00 committed by Daniel A. Wozniak
parent dd4fcd3445
commit 1bf0b18224
No known key found for this signature in database
GPG key ID: 166B9D2C06C82D61

View file

@ -5,7 +5,7 @@ Tests for the file state
'''
# Import python libs
from __future__ import absolute_import, unicode_literals
from __future__ import absolute_import
import errno
import glob
import logging
@ -2650,12 +2650,12 @@ class BlockreplaceTest(ModuleCase, SaltReturnAssertsMixin):
content = os.linesep.join([
'Line 1 of block',
'Line 2 of block',
''])
'']).decode('utf-8')
without_block = os.linesep.join([
'Hello world!',
'',
'# comment here',
''])
'']).decode('utf-8')
with_non_matching_block = os.linesep.join([
'Hello world!',
'',
@ -2663,14 +2663,14 @@ class BlockreplaceTest(ModuleCase, SaltReturnAssertsMixin):
'No match here',
'# end',
'# comment here',
''])
'']).decode('utf-8')
with_non_matching_block_and_marker_end_not_after_newline = os.linesep.join([
'Hello world!',
'',
'# start',
'No match here# end',
'# comment here',
''])
'']).decode('utf-8')
with_matching_block = os.linesep.join([
'Hello world!',
'',
@ -2679,7 +2679,7 @@ class BlockreplaceTest(ModuleCase, SaltReturnAssertsMixin):
'Line 2 of block',
'# end',
'# comment here',
''])
'']).decode('utf-8')
with_matching_block_and_extra_newline = os.linesep.join([
'Hello world!',
'',
@ -2689,7 +2689,7 @@ class BlockreplaceTest(ModuleCase, SaltReturnAssertsMixin):
'',
'# end',
'# comment here',
''])
'']).decode('utf-8')
with_matching_block_and_marker_end_not_after_newline = os.linesep.join([
'Hello world!',
'',
@ -2697,7 +2697,7 @@ class BlockreplaceTest(ModuleCase, SaltReturnAssertsMixin):
'Line 1 of block',
'Line 2 of block# end',
'# comment here',
''])
'']).decode('utf-8')
content_explicit_posix_newlines = ('Line 1 of block\n'
'Line 2 of block\n')
content_explicit_windows_newlines = ('Line 1 of block\r\n'