Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare 7.4.1 release #168

Merged
merged 444 commits into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
444 commits
Select commit Hold shift + click to select a range
500fa28
Merge branch 'master' into eb/package-version
eli-darkly Aug 20, 2019
42ad0be
Merge pull request #112 from launchdarkly/eb/test-cleanup
eli-darkly Aug 20, 2019
1154981
Merge pull request #114 from launchdarkly/eb/package-version
eli-darkly Aug 20, 2019
a5da010
Allow explicitly proxying only ld requests (#130)
gangeli Oct 25, 2019
69f2233
fix broken indirect/patch request, add tests for feature requestor
eli-darkly Oct 28, 2019
0fa5e05
Python 2/3 compatibility for HTTPServer
eli-darkly Oct 28, 2019
e75ff0f
Py2/3 compatibility: queue
eli-darkly Oct 28, 2019
68161a2
more Py3 compatibility
eli-darkly Oct 28, 2019
74c9eed
don't need import of builtins
eli-darkly Oct 28, 2019
032b04c
fix string encoding
eli-darkly Oct 28, 2019
89ce3e2
implement setting proxy URL by environment variable
eli-darkly Oct 29, 2019
ae764b5
rm debugging
eli-darkly Oct 29, 2019
28ee4b5
fix autodoc options to exclude magic methods
eli-darkly Oct 29, 2019
4cbcd30
Merge pull request #115 from launchdarkly/eb/ch54217/indirect-patch
eli-darkly Oct 30, 2019
9fb16a6
Merge pull request #117 from launchdarkly/eb/ch38000/fix-doc-config
eli-darkly Oct 30, 2019
d47c315
Merge pull request #116 from launchdarkly/eb/ch53090/proxy-var
eli-darkly Oct 30, 2019
3dddca2
merge from public after release
LaunchDarklyCI Oct 30, 2019
9435aee
add config option for proxy URL
eli-darkly Oct 31, 2019
4fc6ce7
comment
eli-darkly Oct 31, 2019
00432be
add end-to-end unit tests for proxy config
eli-darkly Oct 31, 2019
5911fd9
indents
eli-darkly Oct 31, 2019
ba52cae
Merge pull request #118 from launchdarkly/eb/ch52414/proxy-config
eli-darkly Oct 31, 2019
28b22b8
merge from public after release
LaunchDarklyCI Oct 31, 2019
35faf7d
Merge branch 'master' of github.com:launchdarkly/python-server-sdk
bwoskow-ld Nov 7, 2019
63125f5
add 3.8 build
eli-darkly Nov 21, 2019
3c68cd2
image name
eli-darkly Nov 21, 2019
9b1adf3
fail on SyntaxWarning
eli-darkly Nov 21, 2019
6a954e3
typo
eli-darkly Nov 21, 2019
d6bf44c
command syntax
eli-darkly Nov 21, 2019
7ec6974
Merge pull request #119 from launchdarkly/eb/ch56849/py3.8
eli-darkly Nov 21, 2019
7fda088
Merge branch 'master' of github.com:launchdarkly/python-server-sdk
eli-darkly Nov 21, 2019
7b3177f
pin expiringdict dependency for Python 3.3 compatibility
eli-darkly Nov 21, 2019
9942d77
add Windows CircleCI job
eli-darkly Nov 21, 2019
38f3f43
periods are no longer valid in CircleCI job names
eli-darkly Nov 21, 2019
c969db2
syntax fix
eli-darkly Nov 21, 2019
bc31ec9
install Python in Windows
eli-darkly Nov 21, 2019
64486a3
set path
eli-darkly Nov 21, 2019
37509ff
move command
eli-darkly Nov 21, 2019
3b41766
turn off debug logging
eli-darkly Nov 21, 2019
ef68058
Py3 in Windows
eli-darkly Nov 21, 2019
0c93df7
config param
eli-darkly Nov 21, 2019
86d27a8
rm redundant step
eli-darkly Nov 21, 2019
001e196
choco switch
eli-darkly Nov 21, 2019
121ec89
Merge pull request #120 from launchdarkly/eb/ch55512/py3.3-deps
eli-darkly Nov 21, 2019
9905cd5
Merge branch 'master' into eb/ch56746/windows-ci
eli-darkly Nov 21, 2019
23a4222
refactor Linux jobs using CircleCI 2.1 features
eli-darkly Nov 21, 2019
a5aaa99
set log level before anything else
eli-darkly Nov 21, 2019
9e40321
rm Azure config
eli-darkly Nov 21, 2019
d69fba0
Merge pull request #121 from launchdarkly/eb/ch56746/windows-ci
eli-darkly Nov 21, 2019
3e9c68b
merge from public after release
LaunchDarklyCI Nov 21, 2019
669e772
use yaml.safe_load() to avoid code execution vulnerability in file da…
eli-darkly Dec 9, 2019
4483990
Merge pull request #122 from launchdarkly/eb/ch58025/yaml-load
eli-darkly Dec 9, 2019
8248bae
merge from public after release
LaunchDarklyCI Dec 10, 2019
52238d1
Initial work on wrapper_name, wrapper_version, diagnostic config
gwhelanLD Dec 16, 2019
38d08bd
Python 2 compat changes.
gwhelanLD Dec 17, 2019
e3eb3ee
More event generation code and starting to integrate tracking diagnos…
gwhelanLD Dec 17, 2019
2d80198
Add minimum diagnostic recording interval. Fix diagnostic.py to be
gwhelanLD Dec 20, 2019
7fd454f
don't let user fall outside of last bucket in rollout
bwoskow-ld Dec 24, 2019
588f352
fixing conditional logic
bwoskow-ld Dec 24, 2019
7b357b0
Add docstrings for diagnostic configuration options.
gwhelanLD Dec 28, 2019
af5a162
fix off-by-1 error
eli-darkly Dec 30, 2019
75a9aab
avoid redundant dict lookups
eli-darkly Dec 30, 2019
590ca64
add unit tests for basic bucketing logic and edge case
eli-darkly Dec 30, 2019
8ce7cb8
Merge pull request #123 from launchdarkly/bw/ch43307/bucket-issue
eli-darkly Dec 30, 2019
87617a3
merge from public after release
LaunchDarklyCI Dec 30, 2019
0f09a73
Stream init tracking. Feeding of accumulator object through SDK. Vari…
gwhelanLD Dec 30, 2019
e50ad29
Track events in last batch.
gwhelanLD Dec 30, 2019
f6ad201
Fix sdk version field, some stylistic improvements.
gwhelanLD Dec 30, 2019
781c2ba
Merge branch 'diag-events' into gw/ch59328/diagnostic-events
gwhelanLD Dec 30, 2019
0375f70
Last of diagnostic configuration object fields.
gwhelanLD Dec 31, 2019
5f2ca11
Fill out rest of platform fields.
gwhelanLD Dec 31, 2019
49a4ea9
Cleanup and failed stream initialization tracking.
gwhelanLD Dec 31, 2019
6f9ca76
Add diagnostic config option test.
gwhelanLD Dec 31, 2019
aa703fb
Add tests for diagnostics.py
gwhelanLD Dec 31, 2019
18d7340
Testing rest of diagnostic fields.
gwhelanLD Dec 31, 2019
c6904c7
Test that streaming update processor records successful and unsuccessful
gwhelanLD Dec 31, 2019
0f9f65c
Improvements to testability of event processor.
gwhelanLD Jan 2, 2020
689b231
Rest of event processor tests.
gwhelanLD Jan 2, 2020
08740f1
Remove janky reflection.
gwhelanLD Jan 6, 2020
a26d458
Test change to filesource optional test requirements.
gwhelanLD Jan 6, 2020
6d5945a
[ch59328] Diagnostic events
gwhelanLD Jan 14, 2020
ef256a5
[ch61092] Add event payload ID on event requests.
gwhelanLD Jan 17, 2020
2866b6d
Merge branch 'master' into diag-events
eli-darkly Feb 11, 2020
3a525e3
normalize data store type and OS name in diagnostic events
eli-darkly Feb 11, 2020
425dceb
gitignore
eli-darkly Feb 11, 2020
71c85b8
Merge pull request #126 from launchdarkly/eb/ch62088/spec-updates
eli-darkly Feb 11, 2020
27fb9a7
copyedit to diagnostic event config property comment
eli-darkly Feb 11, 2020
c93e4ff
Merge pull request #127 from launchdarkly/eb/ch59328/diag-config-comment
eli-darkly Feb 11, 2020
1b0be34
merge from public after release
LaunchDarklyCI Feb 11, 2020
13ddc54
fix spurious error after sending diagnostic event
eli-darkly Feb 12, 2020
a4fc092
Merge pull request #128 from launchdarkly/eb/ch65536/diag-events-warn…
eli-darkly Feb 12, 2020
02f5626
merge from public after release
LaunchDarklyCI Feb 12, 2020
ad248d6
make verify_ssl=False turn off certificate verification too (#129)
eli-darkly Mar 19, 2020
e754335
merge from public after release
LaunchDarklyCI Mar 20, 2020
b7d081b
add more TLS config options and collect HTTP/HTTPS config options in …
eli-darkly Mar 25, 2020
770fd71
make stream retry/backoff/jitter behavior consistent with other SDKs …
eli-darkly Mar 27, 2020
4016887
streams shouldn't use the same read timeout as the rest of the SDK (#…
eli-darkly Mar 30, 2020
f7ec18a
merge from public after release
LaunchDarklyCI Mar 30, 2020
02a803f
implement our own retry logic & logging for event posts, don't use ur…
eli-darkly May 9, 2020
50f2d94
remove support for indirect/patch and indirect/put
eli-darkly Jun 23, 2020
a246026
Merge pull request #134 from launchdarkly/eb/ch80666/no-indirect-patch
eli-darkly Jun 23, 2020
a9fe218
remove unused logic for individual flag/segment poll for indirect/patch
eli-darkly Jun 25, 2020
aaa9455
Merge pull request #135 from launchdarkly/eb/ch80666/no-indirect-patch
eli-darkly Jun 26, 2020
89fa623
merge from public after release
LaunchDarklyCI Jul 13, 2020
e1c93da
Ehaisley/84082/remove python2 (#136)
apache-hb Jul 30, 2020
3095315
Allow authenticating with proxy
gangeli Sep 15, 2020
eb7fc76
Merge pull request #145 from gangeli/master
eli-darkly Sep 16, 2020
14dfd8e
Merge branch 'contrib' of github.com:launchdarkly/python-server-sdk i…
eli-darkly Sep 16, 2020
1de0769
reimplement proxy tests for DRY and add test of proxy auth params
eli-darkly Sep 21, 2020
ed01be0
doc comment on auth params in proxy URL
eli-darkly Sep 16, 2020
6d98ae7
Merge pull request #137 from launchdarkly/eb/ch89791/proxy-auth-in-url
eli-darkly Sep 21, 2020
7bff994
Merge branch '6.x' of github.com:launchdarkly/python-server-sdk into 6.x
eli-darkly Sep 21, 2020
8d34668
merge from public after release
LaunchDarklyCI Sep 21, 2020
b5213b2
Merge branch '6.x'
eli-darkly Sep 22, 2020
c35fa61
add type hints to some of the public facing api.
apache-hb Sep 28, 2020
7745881
Revert "add type hints to some of the public facing api."
apache-hb Sep 28, 2020
43b4c31
Ehaisley/ch86857/type hints (#138)
apache-hb Oct 15, 2020
58b5bc3
remove all current deprecations (#139)
apache-hb Oct 27, 2020
b35ec6e
remove global set_sdk_key, make SDK key required in Config (#140)
eli-darkly Oct 27, 2020
5e3e5c5
Merge branch '6.x' of github.com:launchdarkly/python-server-sdk-private
eli-darkly Oct 28, 2020
3b904f3
merge from public after release
LaunchDarklyCI Oct 28, 2020
eb65618
Merge branch 'master' of github.com:launchdarkly/python-server-sdk
eli-darkly Oct 28, 2020
ebd092d
Merge branch 'master' of github.com:launchdarkly/python-server-sdk
eli-darkly Nov 25, 2020
528dc22
merge from public after release
LaunchDarklyCI Nov 26, 2020
e5f6450
Removed the guides link
bwoskow-ld Feb 3, 2021
4d2e999
Pinning mypy and running it against different python versions (#141)
bwoskow-ld Feb 5, 2021
1cc83f5
fix time zone mishandling that could make event debugging not work (#…
eli-darkly Feb 19, 2021
dc955d3
merge from public after release
LaunchDarklyCI Feb 19, 2021
5fa5966
fix 6.x build (#143)
eli-darkly Feb 23, 2021
c9d6ec6
fix time zone mishandling that could make event debugging not work (6…
eli-darkly Feb 23, 2021
f9ce3b9
prepare 6.13.3 release (#154)
LaunchDarklyCI Feb 23, 2021
953c126
Releasing version 6.13.3
LaunchDarklyCI Feb 23, 2021
faec38d
merge from public after release
LaunchDarklyCI Feb 23, 2021
b740df9
Merge branch '6.x'
eli-darkly Feb 24, 2021
532a01b
[ch99756] Add alias events (#145)
hroederld Mar 11, 2021
35227bf
merge from public after release
LaunchDarklyCI Mar 12, 2021
8c327d0
add support for experiment rollouts
robertjneal Apr 29, 2021
31c1c21
fix unit test
robertjneal Apr 29, 2021
f52ab39
address PR comments
robertjneal May 6, 2021
15f9a97
Merge pull request #146 from launchdarkly/rneal/ch101662/add-support-…
robertjneal May 11, 2021
741a076
merge from public after release
LaunchDarklyCI Jun 17, 2021
527f366
use Releaser v2 config
eli-darkly Sep 21, 2021
d2528ed
Use newer docker images (#147)
bwoskow-ld Sep 22, 2021
8852138
Merge pull request #148 from launchdarkly/eb/ch118712/releaser-v2
eli-darkly Sep 23, 2021
666e5f0
Updates docs URLs
ember-stevens Sep 24, 2021
1db3507
Merge pull request #149 from launchdarkly/emberstevens/sc-118589/url-…
ember-stevens Sep 27, 2021
3286623
Add support for 3.10 (#150)
keelerm84 Oct 6, 2021
3a64bf6
started work on FlagBuilder in as part of test data source implementa…
charukiewicz Nov 22, 2021
dd7561e
finished FlagBuilder implementation and added FlagRuleBuilder impleme…
charukiewicz Nov 23, 2021
b3bd9b4
added initial TestData interface and updated tests to not rely on tes…
charukiewicz Nov 24, 2021
bd87ace
started data source implementation
charukiewicz Nov 30, 2021
fb4aeaf
changed FlagBuilder to public class; changed FlagBuilder attributes t…
charukiewicz Nov 30, 2021
eaa8b04
Merge branch 'cc/sc-130602/test-data-flag-builder' into cc/sc-130602/…
charukiewicz Nov 30, 2021
633669a
(big segments 1) add public config/interface types
eli-darkly Nov 30, 2021
3f624ba
added implementation of test data source
charukiewicz Nov 30, 2021
4ee49e0
docstring
eli-darkly Nov 30, 2021
06a62d3
formatting
eli-darkly Nov 30, 2021
8eb95e1
ensure property doesn't return None
eli-darkly Nov 30, 2021
be01431
(big segments 2) implement evaluation, refactor eval logic & modules
eli-darkly Dec 1, 2021
7fc6fed
linting
eli-darkly Dec 1, 2021
3812412
(big segments 3) implement big segment status tracking, wire up compo…
eli-darkly Dec 2, 2021
b5d9616
typing fixes
eli-darkly Dec 2, 2021
5e75442
typing fixes
eli-darkly Dec 2, 2021
104b7ef
Merge pull request #152 from launchdarkly/eb/sc-132580/big-seg-1-types
eli-darkly Dec 2, 2021
43c01c2
Merge pull request #154 from launchdarkly/eb/sc-132580/big-seg-2-impl
eli-darkly Dec 2, 2021
7439e1f
implement SSE contract tests
eli-darkly Dec 2, 2021
e67d915
fix CI
eli-darkly Dec 2, 2021
38d15c9
fix CI again
eli-darkly Dec 2, 2021
fb93d87
fix CI
eli-darkly Dec 2, 2021
2cd71a6
disable SSE tests in Python 3.5
eli-darkly Dec 2, 2021
aa24aac
make test service port configurable
eli-darkly Dec 2, 2021
9414b33
better SSE implementation that fixes linefeed and multi-byte char issues
eli-darkly Dec 3, 2021
3588db7
fix constructor parameters in test service
eli-darkly Dec 3, 2021
8efc7bf
comment
eli-darkly Dec 3, 2021
7fdd3b3
test improvements
eli-darkly Dec 3, 2021
707fbcb
Merge pull request #155 from launchdarkly/eb/sc-132580/big-seg-3-impl
eli-darkly Dec 3, 2021
e76aef1
rm obsolete default config logic
eli-darkly Dec 3, 2021
fd1e067
Merge pull request #157 from launchdarkly/eb/sc-133195+sc-133324/bett…
eli-darkly Dec 3, 2021
7c986d6
Merge pull request #156 from launchdarkly/eb/sc-125613/sse-contract-t…
eli-darkly Dec 3, 2021
9073e54
merge from public after release
Dec 4, 2021
6657474
(big segments 4) implement big segment stores in Redis+DynamoDB, refa…
eli-darkly Dec 6, 2021
c567777
converted ldclient.integrations module from file to directory; starte…
charukiewicz Dec 6, 2021
3156801
removed setup/teardown functions leftover from test scaffold
charukiewicz Dec 6, 2021
fa7d0f5
Merge pull request #151 from launchdarkly/cc/sc-130602/test-data-flag…
charukiewicz Dec 7, 2021
8abe007
added TestData, FlagBuilder, and FlagRuleBuilder documentation; minor…
charukiewicz Dec 7, 2021
9dd064e
removed warning supression from TestData tests
charukiewicz Dec 7, 2021
86e4038
fix big segments user hash algorithm to use SHA256
eli-darkly Dec 8, 2021
7e8da3d
Merge branch 'master' into big-segments
eli-darkly Dec 8, 2021
a73c4c1
Merge branch 'big-segments' into eb/sc-132580/big-seg-sha256
eli-darkly Dec 8, 2021
9a4981e
update mypy version
eli-darkly Dec 8, 2021
4fbf338
Merge pull request #161 from launchdarkly/eb/sc-134071/mypy-version
eli-darkly Dec 8, 2021
30c3974
Merge branch 'master' into test-data
eli-darkly Dec 8, 2021
c0481f5
Merge branch 'master' into big-segments
eli-darkly Dec 8, 2021
f7d58c0
Merge branch 'big-segments' into eb/sc-132580/big-seg-sha256
eli-darkly Dec 8, 2021
8d56a51
updates to tests and related bug fixes
charukiewicz Dec 8, 2021
a16e744
Merge branch 'test-data' into cc/sc-130602/test-data-datasource
eli-darkly Dec 9, 2021
4cff3b1
Merge branch 'cc/sc-130602/test-data-datasource' into cc/sc-130602/te…
eli-darkly Dec 9, 2021
ecbe95d
always cache Big Segment query result even if it's None
eli-darkly Dec 9, 2021
489f1e7
fix test assertion
eli-darkly Dec 9, 2021
c524e7e
lint
eli-darkly Dec 9, 2021
f8e95bf
fix big segment ref format
eli-darkly Dec 9, 2021
c1d6548
fix big segments cache TTL being set to wrong value
eli-darkly Dec 9, 2021
8f9795e
Merge pull request #160 from launchdarkly/eb/sc-132580/big-seg-sha256
eli-darkly Dec 9, 2021
5f9b501
Merge pull request #162 from launchdarkly/eb/sc-132580/big-seg-cache-…
eli-darkly Dec 9, 2021
0bc07d0
Merge pull request #153 from launchdarkly/cc/sc-130602/test-data-data…
charukiewicz Dec 9, 2021
d593ade
fixed structure of fallthrough variation in result of FlagBuilder.bui…
charukiewicz Dec 9, 2021
b07015d
Merge branch 'cc/sc-130602/test-data-docs' of github.com:launchdarkly…
charukiewicz Dec 9, 2021
45f1e23
moved __test__ attribute into TestData class definition to prevent my…
charukiewicz Dec 9, 2021
5f12700
minor doc comment fix
eli-darkly Dec 10, 2021
5970c04
merge from public after release
Dec 10, 2021
ac75a6d
Merge branch 'master' of github.com:launchdarkly/python-server-sdk
eli-darkly Dec 10, 2021
f06bcae
Merge branch 'master' into test-data
eli-darkly Dec 11, 2021
b5a1342
Merge branch 'test-data' into cc/sc-130602/test-data-docs
eli-darkly Dec 11, 2021
3b1d740
Apply suggestions related to Sphinx docstring formatting from code re…
charukiewicz Dec 13, 2021
f40c7a0
Merge pull request #159 from launchdarkly/cc/sc-130602/test-data-docs
charukiewicz Dec 29, 2021
3baa843
fixed errors in the implementation of FlagBuilder's fallthrough_varia…
charukiewicz Jan 14, 2022
9d49fef
added missing value_for_all_users() method to FlagBuilder class
charukiewicz Jan 24, 2022
d235047
Fix operator parsing errors (#169)
keelerm84 Jan 27, 2022
8171136
identify should not emit event if user key is empty (#164)
keelerm84 Jan 27, 2022
5c1ce47
secondary should be treated as built-in attribute (#168)
keelerm84 Jan 27, 2022
926f94f
URIs should have trailing slashes trimmed (#165)
keelerm84 Jan 27, 2022
387d7ba
all_flags_state should always include flag version (#166)
keelerm84 Jan 27, 2022
515a05e
output event should not include a null prereqOf key (#167)
keelerm84 Jan 27, 2022
de66bc7
Merge pull request #163 from launchdarkly/cc/sc-130602/test-data-bool…
charukiewicz Feb 2, 2022
e22d5ee
Account for traffic allocation on all flags (#171)
keelerm84 Feb 3, 2022
3e1613e
Add SDK contract tests (#170)
keelerm84 Feb 3, 2022
26f7ec9
Merge branch 'master' of github.com:launchdarkly/python-server-sdk
eli-darkly Feb 14, 2022
a8b1404
Merge branch 'master' into test-data
eli-darkly Feb 14, 2022
175697b
misc fixes to test data docs + add type hints
eli-darkly Feb 14, 2022
787c715
more type hints
eli-darkly Feb 14, 2022
65e733d
remove some methods from the public test_data API
eli-darkly Feb 14, 2022
23f066c
can't use "x|y" shortcut in typehints in older Pythons; use Union
eli-darkly Feb 14, 2022
063752a
fix misc type mistakes because I forgot to run the linter
eli-darkly Feb 14, 2022
cd39e1c
Merge pull request #172 from launchdarkly/eb/sc-130602/test-data-docs…
eli-darkly Feb 14, 2022
db63930
Merge branch 'test-data' into eb/sc-130602/test-data-private-methods
eli-darkly Feb 14, 2022
3be9135
Merge pull request #173 from launchdarkly/eb/sc-130602/test-data-priv…
eli-darkly Feb 14, 2022
941b858
merge from public after release
Feb 14, 2022
4f6f6cf
update CONTRIBUTING.md and provide make targets
eli-darkly Feb 14, 2022
8ba0eeb
Merge branch 'test-data'
eli-darkly Feb 15, 2022
85bf5a2
Merge pull request #174 from launchdarkly/eb/sc-132599/coding-guidelines
eli-darkly Feb 16, 2022
394982f
merge from public after release
Feb 16, 2022
9c152c3
fixed a bug with flag rule clause builder internals; added unit test …
charukiewicz Mar 15, 2022
2d5744b
added ready argument to _TestDataSource class and indicated ready upo…
charukiewicz Mar 15, 2022
1f21ca5
Update contract tests to latest flask version (#176)
keelerm84 Mar 16, 2022
fb9494b
Merge branch 'master' into cc/sc-130602/test-data-flag-rule-builder-o…
charukiewicz Mar 16, 2022
dc35497
Merge pull request #175 from launchdarkly/cc/sc-130602/test-data-flag…
charukiewicz Mar 16, 2022
fd06213
Merge branch 'master' into private-master
keelerm84 Apr 19, 2022
5c5a3e8
Handle explicit None values in test payload (#179)
keelerm84 Apr 20, 2022
c984111
Fix "unhandled response" error in test harness (#180)
keelerm84 Apr 20, 2022
0ce9153
Exclude booleans when getting bucketable value (#181)
keelerm84 Apr 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions ldclient/integrations/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def fallthrough_variation(self, variation):
:return: the flag builder
"""
if isinstance(variation, bool):
self._boolean_flag(self)._fallthrough_variation = variation
self.boolean_flag()._fallthrough_variation = _variation_for_boolean(variation)
return self
else:
self._fallthrough_variation = variation
Expand All @@ -222,7 +222,7 @@ def off_variation(self, variation) :
:return: the flag builder
"""
if isinstance(variation, bool):
self._boolean_flag(self)._off_variation = variation
self.boolean_flag()._off_variation = _variation_for_boolean(variation)
return self
else:
self._off_variation = variation
Expand Down Expand Up @@ -267,7 +267,7 @@ def variations(self, *variations):

**Example:** Multiple variations

::
::
td.flag('new-flag') \
.variations('red', 'green', 'blue')

Expand Down Expand Up @@ -297,6 +297,20 @@ def variation_for_all_users(self, variation):
else:
return self.clear_rules().clear_targets().on(True).fallthrough_variation(variation)

def value_for_all_users(self, value):
"""
Sets the flag to always return the specified variation value for all users.

The value may be of any JSON type. This method changes the flag to have only
a single variation, which is this value, and to return the same variation
regardless of whether targeting is on or off. Any existing targets or rules
are removed.

:param value the desired value to be returned for all users
:return the flag builder
"""
return self.variations(value).variation_for_all_users(0)

def variation_for_user(self, user_key, variation):
"""Sets the flag to return the specified variation for a specific user key when targeting
is on.
Expand Down
24 changes: 24 additions & 0 deletions testing/test_test_data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,21 @@ def test_flagbuilder_can_set_fallthrough_variation():

assert flag.build(0)['fallthrough'] == {'variation': 2}

flag.fallthrough_variation(True)

assert flag.build(0)['fallthrough'] == {'variation': 0}

def test_flagbuilder_can_set_off_variation():
td = TestData.data_source()
flag = td.flag('test-flag')
flag.off_variation(2)

assert flag.build(0)['offVariation'] == 2

flag.off_variation(True)

assert flag.build(0)['offVariation'] == 0

def test_flagbuilder_can_make_boolean_flag():
td = TestData.data_source()
flag = td.flag('boolean-flag').boolean_flag()
Expand Down Expand Up @@ -243,6 +251,22 @@ def test_flagbuilder_can_set_numerical_variation_for_user():
]
assert flag.build(1)['targets'] == expected_targets

def test_flagbuilder_can_set_value_for_all_users():
td = TestData.data_source()
flag = td.flag('user-value-flag')
flag.variation_for_user('john', 1)

built_flag = flag.build(0)
assert built_flag['targets'] == [{'values': ['john'], 'variation': 1}]
assert built_flag['variations'] == [True, False]

flag.value_for_all_users('yes')

built_flag2 = flag.build(0)
assert built_flag2['targets'] == []
assert built_flag2['variations'] == ['yes']


def test_flagbuilder_can_build():
td = TestData.data_source()
flag = td.flag('some-flag')
Expand Down