diff options
| author | Thomi Richards <thomi.richards@canonical.com> | 2013-11-20 14:28:49 +1300 |
|---|---|---|
| committer | Thomi Richards <thomi.richards@canonical.com> | 2013-11-20 14:28:49 +1300 |
| commit | a1e4e89846b3c236569c2fb275527584635bcd7f (patch) | |
| tree | d96187d0a4cbc1e3d08fc7cff70146686e456213 /python/subunit/tests | |
| parent | 4c9b32360c7f2c3cc82c438d0206dc484c85ad02 (diff) | |
| download | subunit-a1e4e89846b3c236569c2fb275527584635bcd7f.tar.gz | |
code cleanup, added a few more tests for the --file-name option.
Diffstat (limited to 'python/subunit/tests')
| -rw-r--r-- | python/subunit/tests/test_output_filter.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/python/subunit/tests/test_output_filter.py b/python/subunit/tests/test_output_filter.py index 15dce81..ede32dc 100644 --- a/python/subunit/tests/test_output_filter.py +++ b/python/subunit/tests/test_output_filter.py @@ -90,6 +90,13 @@ class TestStatusArgParserTests(WithScenarios, TestCase): ) self.assertThat(args.mimetype, Equals("text/plain")) + def test_all_commands_accept_file_name_argument(self): + with NamedTemporaryFile() as tmp_file: + args = safe_parse_arguments( + args=[self.option, 'foo', '--attach-file', tmp_file.name, '--file-name', "foo"] + ) + self.assertThat(args.file_name, Equals("foo")) + def test_all_commands_accept_tags_argument(self): args = safe_parse_arguments( args=[self.option, 'foo', '--tags', "foo,bar,baz"] @@ -104,6 +111,19 @@ class TestStatusArgParserTests(WithScenarios, TestCase): self.assertThat(args.attach_file.read(), Equals("Hello")) + def test_attach_file_with_hyphen_sets_filename_to_stdin(self): + args = safe_parse_arguments( + args=[self.option, "foo", "--attach-file", "-"] + ) + + self.assertThat(args.file_name, Equals("stdin")) + + def test_can_override_stdin_filename(self): + args = safe_parse_arguments( + args=[self.option, "foo", "--attach-file", "-", '--file-name', 'foo'] + ) + + self.assertThat(args.file_name, Equals("foo")) class ArgParserTests(TestCase): |
