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

Side by Side Diff: client/libs/logdog/tests/bootstrap_test.py

Issue 1961603002: Add LogDog Python client library. (Closed) Base URL: https://github.com/luci/luci-py@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2016 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed by the Apache v2.0 license that can be
3 # found in the LICENSE file.
4
5 import unittest
6 import itertools
7 import StringIO
8
9 from client.libs.logdog import bootstrap
10
11
12 class BootstrapTestCase(unittest.TestCase):
13
14 def setUp(self):
15 self.env = {
16 bootstrap.ButlerBootstrap._ENV_PROJECT: 'test-project',
17 bootstrap.ButlerBootstrap._ENV_PREFIX: 'foo/bar',
18 bootstrap.ButlerBootstrap._ENV_STREAM_SERVER_PATH: 'fake:path',
19 }
20
21 def testProbeSucceeds(self):
22 bs = bootstrap.ButlerBootstrap.probe(self.env)
23 self.assertEqual(bs, bootstrap.ButlerBootstrap(
24 project='test-project',
25 prefix='foo/bar',
26 streamserver_uri='fake:path'))
27
28 def testProbeNoBootstrapRaisesError(self):
29 self.assertRaises(bootstrap.NotBootstrappedError,
30 bootstrap.ButlerBootstrap.probe, env={})
31
32 def testProbeMissingProjectRaisesError(self):
33 self.env.pop(bootstrap.ButlerBootstrap._ENV_PROJECT)
34 self.assertRaises(bootstrap.NotBootstrappedError,
35 bootstrap.ButlerBootstrap.probe, env=self.env)
36
37 def testProbeMissingPrefixRaisesError(self):
38 self.env.pop(bootstrap.ButlerBootstrap._ENV_PREFIX)
39 self.assertRaises(bootstrap.NotBootstrappedError,
40 bootstrap.ButlerBootstrap.probe, env=self.env)
41
42 def testProbeInvalidPrefixRaisesError(self):
43 self.env[bootstrap.ButlerBootstrap._ENV_PREFIX] = '!!! not valid !!!'
44 self.assertRaises(bootstrap.NotBootstrappedError,
45 bootstrap.ButlerBootstrap.probe, env=self.env)
46
47
48 if __name__ == '__main__':
49 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698