Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(571)

Unified Diff: recipe_engine/unittests/stream_test.py

Issue 2792333003: Assert validity of stream parameters. (Closed)
Patch Set: fix spelling Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « recipe_engine/stream.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_engine/unittests/stream_test.py
diff --git a/recipe_engine/unittests/stream_test.py b/recipe_engine/unittests/stream_test.py
index 365bc1c99fa4520c8a3c47150cecd23dc4af06d7..748d29d7a94e1f109b3a56b5989e6db065588c22 100755
--- a/recipe_engine/unittests/stream_test.py
+++ b/recipe_engine/unittests/stream_test.py
@@ -161,5 +161,48 @@ bar tries to kiss foo, but foo already left
with self.assertRaises(AssertionError):
foo.set_step_status('SUCCESS')
+ def test_content_assertions(self):
+ with stream.StreamEngineInvariants() as engine:
+ with self.assertRaises(ValueError):
+ engine.make_step_stream('foo\nbar')
+
+ # Test StepStream.
+ s = engine.make_step_stream('foo')
+ with self.assertRaises(ValueError):
+ s.new_log_stream('foo\nbar')
+ ls = s.new_log_stream('foo')
+
+ with self.assertRaises(ValueError):
+ s.add_step_text('foo\nbar')
+ s.add_step_text('foo')
+
+ with self.assertRaises(ValueError):
+ s.add_step_summary_text('foo\nbar')
+ s.add_step_summary_text('foo')
+
+ with self.assertRaises(ValueError):
+ s.add_step_link('foo\nbar', 'baz')
+ with self.assertRaises(ValueError):
+ s.add_step_link('foo', 'bar\nbaz')
+ s.add_step_link('foo', 'bar')
+
+ with self.assertRaises(ValueError):
+ s.set_build_property('foo\nbar', 'true')
+ with self.assertRaises(ValueError):
+ s.set_build_property('foo', 'true\n')
+ with self.assertRaises(ValueError):
+ s.set_build_property('foo', 'NOT JSON')
+ s.set_build_property('foo', '"Is JSON"')
+
+ with self.assertRaises(ValueError):
+ s.trigger('true\n')
+ with self.assertRaises(ValueError):
+ s.trigger('NOT JSON')
+ s.trigger('"Is JSON"')
+
+ ls.close()
+ s.close()
+
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « recipe_engine/stream.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698