diff options
| author | Thomi Richards <thomi.richards@canonical.com> | 2013-11-25 18:01:46 +1300 |
|---|---|---|
| committer | Thomi Richards <thomi.richards@canonical.com> | 2013-11-25 18:01:46 +1300 |
| commit | 2625bc70ecd451408830f98866f97f66e668dec3 (patch) | |
| tree | 7bd7c822ca2a6412cfed918787386feec5286880 /python/subunit/tests | |
| parent | 75f59c356ace28ac6269a7aaf8d9e1e62f0c946c (diff) | |
| download | subunit-git-2625bc70ecd451408830f98866f97f66e668dec3.tar.gz | |
Add a few missing tests.
Diffstat (limited to 'python/subunit/tests')
| -rw-r--r-- | python/subunit/tests/test_output_filter.py | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/python/subunit/tests/test_output_filter.py b/python/subunit/tests/test_output_filter.py index 401ec08..f3000ad 100644 --- a/python/subunit/tests/test_output_filter.py +++ b/python/subunit/tests/test_output_filter.py @@ -292,6 +292,17 @@ class StatusStreamResultTests(WithScenarios, TestCase): ]) ) + def test_file_is_sent_with_test_status(self): + with temp_file_contents(b"Hello") as f: + result = get_result_for([self.option, self.test_id, '--attach-file', f.name]) + + self.assertThat( + result._events, + MatchesListwise([ + MatchesStatusCall(test_status=self.status, file_bytes=b'Hello', eof=True), + ]) + ) + def test_file_chunk_size_is_honored(self): with temp_file_contents(b"Hello") as f: self.patch(_o, '_CHUNK_SIZE', 1) @@ -419,7 +430,7 @@ class StatusStreamResultTests(WithScenarios, TestCase): ) -class GlobalFileDataTests(TestCase): +class FileDataTests(TestCase): def test_can_attach_file_without_test_id(self): with temp_file_contents(b"Hello") as f: @@ -450,7 +461,8 @@ class GlobalFileDataTests(TestCase): '--attach-file', f.name, '--file-name', - specified_file_name]) + specified_file_name + ]) self.assertThat( result._events, @@ -459,6 +471,24 @@ class GlobalFileDataTests(TestCase): ]) ) + def test_files_have_timestamp(self): + _dummy_timestamp = datetime.datetime(2013, 1, 1, 0, 0, 0, 0, UTC) + self.patch(_o, 'create_timestamp', lambda: self._dummy_timestamp) + + with temp_file_contents(b"Hello") as f: + specified_file_name = self.getUniqueString() + result = get_result_for([ + '--attach-file', + f.name, + ]) + + self.assertThat( + result._events, + MatchesListwise([ + MatchesStatusCall(file_bytes=b'Hello', timestamp=self._dummy_timestamp), + ]) + ) + class MatchesStatusCall(Matcher): |
