| Index: recipe_engine/third_party/client-py/libs/logdog/tests/streamname_test.py
|
| diff --git a/recipe_engine/third_party/client-py/libs/logdog/tests/streamname_test.py b/recipe_engine/third_party/client-py/libs/logdog/tests/streamname_test.py
|
| index f5898a4fe02825e83dc9dfa73a360646aa37bb52..c84292a6554a30417868d8ed57089a6afd84c422 100755
|
| --- a/recipe_engine/third_party/client-py/libs/logdog/tests/streamname_test.py
|
| +++ b/recipe_engine/third_party/client-py/libs/logdog/tests/streamname_test.py
|
| @@ -43,6 +43,24 @@ class StreamNameTestCase(unittest.TestCase):
|
| raised = True
|
| self.assertFalse(raised, "Stream name '%s' raised ValueError" % (name,))
|
|
|
| + def testNormalize(self):
|
| + for name, normalized in (
|
| + ('', 'PFX'),
|
| + ('_invalid_start_char', 'PFX_invalid_start_char'),
|
| + ('valid_stream_name.1:2-3', 'valid_stream_name.1:2-3'),
|
| + ('some stream (with stuff)', 'some_stream__with_stuff_'),
|
| + ('_invalid/st!ream/name entry', 'PFX_invalid/st_ream/name_entry'),
|
| + (' ', 'PFX_____'),
|
| + ):
|
| + self.assertEqual(streamname.normalize(name, prefix='PFX'), normalized)
|
| +
|
| + # Assert that an empty stream name with no prefix will raise a ValueError.
|
| + self.assertRaises(ValueError, streamname.normalize, '')
|
| +
|
| + # Assert that a stream name with an invalid starting character and no prefix
|
| + # will raise a ValueError.
|
| + self.assertRaises(ValueError, streamname.normalize, '_invalid_start_char')
|
| +
|
|
|
| if __name__ == '__main__':
|
| unittest.main()
|
|
|