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

Unified Diff: client/libs/logdog/tests/bootstrap_test.py

Issue 2453273002: Update LogDog client library to generate URLs. (Closed)
Patch Set: Forgot project, oops. Addressed nits. Created 4 years, 2 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 | « client/libs/logdog/streamname.py ('k') | client/libs/logdog/tests/stream_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/libs/logdog/tests/bootstrap_test.py
diff --git a/client/libs/logdog/tests/bootstrap_test.py b/client/libs/logdog/tests/bootstrap_test.py
index 0d5f968dcd4be3303c753ac01ae7b8e6b2ff7ad2..21b0c674c3b93672357ff656a76a0894d8ad9a8d 100755
--- a/client/libs/logdog/tests/bootstrap_test.py
+++ b/client/libs/logdog/tests/bootstrap_test.py
@@ -12,7 +12,7 @@ ROOT_DIR = os.path.dirname(os.path.abspath(os.path.join(
os.pardir, os.pardir, os.pardir)))
sys.path.insert(0, ROOT_DIR)
-from libs.logdog import bootstrap
+from libs.logdog import bootstrap, stream
class BootstrapTestCase(unittest.TestCase):
@@ -22,6 +22,7 @@ class BootstrapTestCase(unittest.TestCase):
bootstrap.ButlerBootstrap._ENV_PROJECT: 'test-project',
bootstrap.ButlerBootstrap._ENV_PREFIX: 'foo/bar',
bootstrap.ButlerBootstrap._ENV_STREAM_SERVER_PATH: 'fake:path',
+ bootstrap.ButlerBootstrap._ENV_COORDINATOR_HOST: 'example.appspot.com',
}
def testProbeSucceeds(self):
@@ -29,7 +30,8 @@ class BootstrapTestCase(unittest.TestCase):
self.assertEqual(bs, bootstrap.ButlerBootstrap(
project='test-project',
prefix='foo/bar',
- streamserver_uri='fake:path'))
+ streamserver_uri='fake:path',
+ coordinator_host='example.appspot.com'))
def testProbeNoBootstrapRaisesError(self):
self.assertRaises(bootstrap.NotBootstrappedError,
@@ -50,6 +52,26 @@ class BootstrapTestCase(unittest.TestCase):
self.assertRaises(bootstrap.NotBootstrappedError,
bootstrap.ButlerBootstrap.probe, env=self.env)
+ def testCreateStreamClient(self):
+ class TestStreamClient(stream.StreamClient):
+ @classmethod
+ def _create(cls, _value, **kwargs):
+ return cls(**kwargs)
+
+ def _connect_raw(self):
+ raise NotImplementedError()
+
+ reg = stream.StreamProtocolRegistry()
+ reg.register_protocol('test', TestStreamClient)
+ bs = bootstrap.ButlerBootstrap(
+ project='test-project',
+ prefix='foo/bar',
+ streamserver_uri='test:',
+ coordinator_host='example.appspot.com')
+ sc = bs.stream_client(reg=reg)
+ self.assertEqual(sc.prefix, 'foo/bar')
+ self.assertEqual(sc.coordinator_host, 'example.appspot.com')
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « client/libs/logdog/streamname.py ('k') | client/libs/logdog/tests/stream_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698