Skip to content

Commit 42cc384

Browse files
committed
Add sign_in test with config info.
1 parent df02ccd commit 42cc384

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

plotly/plotly/plotly.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,16 @@
5252
### _credentials stuff ###
5353

5454

55-
def sign_in(username, api_key):
55+
def sign_in(username, api_key, **kwargs):
5656
"""Set module-scoped _credentials for session. Verify with plotly."""
5757
global _credentials
5858
_credentials['username'], _credentials['api_key'] = username, api_key
5959
# TODO: verify these _credentials with plotly
6060

61+
global _config
62+
_config['plotly_domain'] = kwargs.get('plotly_domain')
63+
_config['plotly_streaming_domain'] = kwargs.get('plotly_streaming_domain')
64+
6165

6266
### plot options stuff ###
6367

plotly/tests/test_core/test_plotly/test_credentials.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,20 @@ def test_get_config(self):
4545
self.assertEqual(
4646
config3['plotly_streaming_domain'], plotly_streaming_domain
4747
)
48+
49+
def test_sign_in_with_config(self):
50+
username = 'place holder'
51+
api_key = 'place holder'
52+
plotly_domain = 'test domain'
53+
plotly_streaming_domain = 'test streaming domain'
54+
py.sign_in(
55+
username,
56+
api_key,
57+
plotly_domain=plotly_domain,
58+
plotly_streaming_domain=plotly_streaming_domain
59+
)
60+
config = py.get_config()
61+
self.assertEqual(config['plotly_domain'], plotly_domain)
62+
self.assertEqual(
63+
config['plotly_streaming_domain'], plotly_streaming_domain
64+
)

0 commit comments

Comments
 (0)