| @@ 9-41 (lines=33) @@ | ||
| 6 | from gitman.common import _Config |
|
| 7 | ||
| 8 | ||
| 9 | class TestShowConsole: |
|
| 10 | ||
| 11 | def setup_method(self, _): |
|
| 12 | _Config.indent_level = 0 |
|
| 13 | _Config.verbosity = 0 |
|
| 14 | self.file = Mock() |
|
| 15 | ||
| 16 | def test_show(self): |
|
| 17 | common.show("Hello, world!", file=self.file) |
|
| 18 | ||
| 19 | assert [ |
|
| 20 | call.write("Hello, world!"), |
|
| 21 | call.write("\n"), |
|
| 22 | ] == self.file.mock_calls |
|
| 23 | ||
| 24 | def test_show_after_indent(self): |
|
| 25 | common.indent() |
|
| 26 | common.show("|\n", file=self.file) |
|
| 27 | ||
| 28 | assert [ |
|
| 29 | call.write(" |\n"), |
|
| 30 | call.write("\n"), |
|
| 31 | ] == self.file.mock_calls |
|
| 32 | ||
| 33 | def test_show_after_1_indent_2_dedent(self): |
|
| 34 | common.indent() |
|
| 35 | common.dedent() |
|
| 36 | common.dedent() |
|
| 37 | common.show("|\n", file=self.file) |
|
| 38 | ||
| 39 | assert [ |
|
| 40 | call.write("|\n"), |
|
| 41 | call.write("\n"), |
|
| 42 | ] == self.file.mock_calls |
|
| 43 | ||
| 44 | ||
| @@ 45-74 (lines=30) @@ | ||
| 42 | ] == self.file.mock_calls |
|
| 43 | ||
| 44 | ||
| 45 | class TestShowLog: |
|
| 46 | ||
| 47 | def setup_method(self, _): |
|
| 48 | _Config.indent_level = 0 |
|
| 49 | _Config.verbosity = 1 |
|
| 50 | self.log = Mock() |
|
| 51 | ||
| 52 | def test_show(self): |
|
| 53 | common.show("Hello, world!", log=self.log) |
|
| 54 | ||
| 55 | assert [ |
|
| 56 | call.info("Hello, world!"), |
|
| 57 | ] == self.log.mock_calls |
|
| 58 | ||
| 59 | def test_show_after_indent(self): |
|
| 60 | common.indent() |
|
| 61 | common.show("|\n", log=self.log) |
|
| 62 | ||
| 63 | assert [ |
|
| 64 | call.info("|"), |
|
| 65 | ] == self.log.mock_calls |
|
| 66 | ||
| 67 | def test_show_after_1_indent_2_dedent(self): |
|
| 68 | common.indent() |
|
| 69 | common.dedent() |
|
| 70 | common.dedent() |
|
| 71 | common.show("|\n", log=self.log) |
|
| 72 | ||
| 73 | assert [ |
|
| 74 | call.info("|"), |
|
| 75 | ] == self.log.mock_calls |
|
| 76 | ||
| 77 | ||