diff options
| author | Robert Collins <robertc@robertcollins.net> | 2008-12-07 06:57:05 +1100 |
|---|---|---|
| committer | Robert Collins <robertc@robertcollins.net> | 2008-12-07 06:57:05 +1100 |
| commit | 24ec56b54f6bb1b1d1d13a8314213c7c68902514 (patch) | |
| tree | cc384b842eb5f75d8b4ac5c5bbc18310afcfc7a0 /python/subunit/tests | |
| parent | 632755acd911e3149501d7e36a0c3426947ab918 (diff) | |
| download | subunit-git-24ec56b54f6bb1b1d1d13a8314213c7c68902514.tar.gz | |
Implement tags support in the protocol server, supporting clients that want to define tags.
Diffstat (limited to 'python/subunit/tests')
| -rw-r--r-- | python/subunit/tests/test_test_protocol.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py index 0083954..7f5bbe4 100644 --- a/python/subunit/tests/test_test_protocol.py +++ b/python/subunit/tests/test_test_protocol.py @@ -521,6 +521,59 @@ class TestTestProtocolServerAddSuccess(unittest.TestCase): self.simple_success_keyword("successful:") +class TestTestProtocolServerStreamTags(unittest.TestCase): + """Test managing tags on the protocol level.""" + + def setUp(self): + self.client = MockTestProtocolServerClient() + self.protocol = subunit.TestProtocolServer(self.client) + + def test_initial_tags(self): + self.protocol.lineReceived("tags: foo bar:baz quux\n") + self.assertEqual(set(["foo", "bar:baz", "quux"]), + self.protocol.tags) + + def test_minus_removes_tags(self): + self.protocol.lineReceived("tags: foo bar\n") + self.protocol.lineReceived("tags: -bar quux\n") + self.assertEqual(set(["foo", "quux"]), + self.protocol.tags) + + def test_tags_get_set_on_test_no_tags(self): + self.protocol.lineReceived("test mcdonalds farm\n") + test = self.client.start_calls[-1] + self.assertEqual(set(), test.tags) + + def test_tags_get_set_on_test_protocol_tags_only(self): + self.protocol.lineReceived("tags: foo bar\n") + self.protocol.lineReceived("test mcdonalds farm\n") + test = self.client.start_calls[-1] + self.assertEqual(set(["foo", "bar"]), test.tags) + + def test_tags_get_set_on_test_simple(self): + self.protocol.lineReceived("test mcdonalds farm\n") + test = self.client.start_calls[-1] + self.protocol.lineReceived("tags: foo bar\n") + self.assertEqual(set(["foo", "bar"]), test.tags) + self.assertEqual(set(), self.protocol.tags) + + def test_tags_get_set_on_test_minus_removes(self): + self.protocol.lineReceived("test mcdonalds farm\n") + test = self.client.start_calls[-1] + self.protocol.lineReceived("tags: foo bar\n") + self.protocol.lineReceived("tags: -bar quux\n") + self.assertEqual(set(["foo", "quux"]), test.tags) + self.assertEqual(set(), self.protocol.tags) + + def test_test_tags_inherit_protocol_tags(self): + self.protocol.lineReceived("tags: foo bar\n") + self.protocol.lineReceived("test mcdonalds farm\n") + test = self.client.start_calls[-1] + self.protocol.lineReceived("tags: -bar quux\n") + self.assertEqual(set(["foo", "quux"]), test.tags) + self.assertEqual(set(["foo", "bar"]), self.protocol.tags) + + class TestRemotedTestCase(unittest.TestCase): def test_simple(self): |
