summaryrefslogtreecommitdiff
path: root/service/test
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2014-11-24 18:00:16 +0100
committerFolker Bernitt <fbernitt@thoughtworks.com>2014-11-24 18:00:16 +0100
commitced2b82f8e6d5e7759d7669b2083f30e59637ecc (patch)
tree0cd210fe7db47acd9a8abc0e36d7e5df18d65a89 /service/test
parent0873555b28027296b1ba4b594a19444138c204d7 (diff)
Added capability to read credentials from stdin.
- See issue https://github.com/pixelated-project/pixelated-dispatcher/issues/40
Diffstat (limited to 'service/test')
-rw-r--r--service/test/unit/runserver_test.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/service/test/unit/runserver_test.py b/service/test/unit/runserver_test.py
index 51ee899c..801a60bf 100644
--- a/service/test/unit/runserver_test.py
+++ b/service/test/unit/runserver_test.py
@@ -59,6 +59,22 @@ class RunserverTest(unittest.TestCase):
sys.argv = ['tmp/does_not_exist', '--dispatcher', fifo_path]
pixelated.runserver.setup()
+ def test_that_organization_switch_reads_the_credentials_from_stdin(self):
+ data = json.dumps({'leap_provider_hostname': 'test_provider', 'user': 'test_user', 'password': 'test_password'})
+ orig_stdin = sys.stdin
+ try:
+ sys.stdin = Mock()
+ when(sys.stdin).read().thenReturn(data)
+
+ sys.argv = ['tmp/does_not_exist', '--dispatcher-stdin']
+ pixelated.runserver.setup()
+
+ self.assertEquals('test_provider', pixelated.runserver.app.config['LEAP_SERVER_NAME'])
+ self.assertEquals('test_user', pixelated.runserver.app.config['LEAP_USERNAME'])
+ self.assertEquals('test_password', pixelated.runserver.app.config['LEAP_PASSWORD'])
+ finally:
+ sys.stdin = orig_stdin
+
def test_start_services_provides_port(self):
bind_address = '127.0.0.1'
bind_port = 12345