mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
lint: get_context is in stringutils.py now
This commit is contained in:
parent
3416e398c6
commit
a40f007962
1 changed files with 5 additions and 5 deletions
|
@ -426,31 +426,31 @@ class TestGetTemplate(TestCase):
|
|||
|
||||
def test_get_context_has_enough_context(self):
|
||||
template = '1\n2\n3\n4\n5\n6\n7\n8\n9\na\nb\nc\nd\ne\nf'
|
||||
context = get_context(template, 8)
|
||||
context = salt.utils.stringutils.get_context(template, 8)
|
||||
expected = '---\n[...]\n3\n4\n5\n6\n7\n8\n9\na\nb\nc\nd\n[...]\n---'
|
||||
self.assertEqual(expected, context)
|
||||
|
||||
def test_get_context_at_top_of_file(self):
|
||||
template = '1\n2\n3\n4\n5\n6\n7\n8\n9\na\nb\nc\nd\ne\nf'
|
||||
context = get_context(template, 1)
|
||||
context = salt.utils.stringutils.get_context(template, 1)
|
||||
expected = '---\n1\n2\n3\n4\n5\n6\n[...]\n---'
|
||||
self.assertEqual(expected, context)
|
||||
|
||||
def test_get_context_at_bottom_of_file(self):
|
||||
template = '1\n2\n3\n4\n5\n6\n7\n8\n9\na\nb\nc\nd\ne\nf'
|
||||
context = get_context(template, 15)
|
||||
context = salt.utils.stringutils.get_context(template, 15)
|
||||
expected = '---\n[...]\na\nb\nc\nd\ne\nf\n---'
|
||||
self.assertEqual(expected, context)
|
||||
|
||||
def test_get_context_2_context_lines(self):
|
||||
template = '1\n2\n3\n4\n5\n6\n7\n8\n9\na\nb\nc\nd\ne\nf'
|
||||
context = get_context(template, 8, num_lines=2)
|
||||
context = salt.utils.stringutils.get_context(template, 8, num_lines=2)
|
||||
expected = '---\n[...]\n6\n7\n8\n9\na\n[...]\n---'
|
||||
self.assertEqual(expected, context)
|
||||
|
||||
def test_get_context_with_marker(self):
|
||||
template = '1\n2\n3\n4\n5\n6\n7\n8\n9\na\nb\nc\nd\ne\nf'
|
||||
context = get_context(template, 8, num_lines=2, marker=' <---')
|
||||
context = salt.utils.stringutils.get_context(template, 8, num_lines=2, marker=' <---')
|
||||
expected = '---\n[...]\n6\n7\n8 <---\n9\na\n[...]\n---'
|
||||
self.assertEqual(expected, context)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue