This repository was archived by the owner on May 5, 2022. It is now read-only.
forked from launchdarkly/python-server-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_init.py
More file actions
49 lines (33 loc) · 1.39 KB
/
Copy pathtest_init.py
File metadata and controls
49 lines (33 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import logging
from pprint import pprint
import ldclient
from ldclient import Config
logging.basicConfig(level=logging.DEBUG)
mylogger = logging.getLogger()
def test_set_sdk_key():
old_sdk_key = "OLD_SDK_KEY"
new_sdk_key = "NEW_SDK_KEY"
old_config = Config(sdk_key=old_sdk_key, stream=False, offline=True)
ldclient.set_config(old_config)
old_client = ldclient.get()
assert old_client.get_sdk_key() == old_sdk_key
ldclient.set_sdk_key(new_sdk_key)
new_client = ldclient.get()
assert new_client.get_sdk_key() == new_sdk_key
# illustrates bad behavior- assigning value of ldclient.get() means
# the old_client didn't get updated when we called set_sdk_key()
assert old_client.get_sdk_key() == old_sdk_key
def test_set_config():
old_sdk_key = "OLD_SDK_KEY"
new_sdk_key = "NEW_SDK_KEY"
old_config = Config(sdk_key=old_sdk_key, stream=False, offline=True)
new_config = Config(sdk_key=new_sdk_key, stream=False, offline=True)
ldclient.set_config(old_config)
old_client = ldclient.get()
assert old_client.get_sdk_key() == old_sdk_key
ldclient.set_config(new_config)
new_client = ldclient.get()
assert new_client.get_sdk_key() == new_sdk_key
# illustrates bad behavior- assigning value of ldclient.get() means
# the old_client didn't get updated when we called set_config()
assert old_client.get_sdk_key() == old_sdk_key