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 6.6.0 release #101

Merged
merged 20 commits into from
Nov 14, 2018
Merged
Changes from 2 commits
Commits
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
8 changes: 7 additions & 1 deletion ldclient/flags_state.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import time

class FeatureFlagsState(object):
"""
@@ -17,7 +18,12 @@ def add_flag(self, flag, value, variation, reason, details_only_if_tracked):
key = flag['key']
self.__flag_values[key] = value
meta = {}
if (not details_only_if_tracked) or flag.get('trackEvents') or flag.get('debugEventsUntilDate'):
with_details = (not details_only_if_tracked) or flag.get('trackEvents')
if not with_details:
if flag.get('debugEventsUntilDate'):
now = int(time.time() * 1000)
with_details = (flag.get('debugEventsUntilDate') > now)
if with_details:
meta['version'] = flag.get('version')
if reason is not None:
meta['reason'] = reason
6 changes: 4 additions & 2 deletions testing/test_ldclient_evaluation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
import json
import time
from ldclient.client import LDClient, Config
from ldclient.feature_store import InMemoryFeatureStore
from ldclient.flag import EvaluationDetail
@@ -228,6 +229,7 @@ def test_all_flags_state_can_be_filtered_for_client_side_flags():
assert values == { 'client-side-1': 'value1', 'client-side-2': 'value2' }

def test_all_flags_state_can_omit_details_for_untracked_flags():
future_time = (time.time() * 1000) + 100000
flag1 = {
'key': 'key1',
'version': 100,
@@ -250,7 +252,7 @@ def test_all_flags_state_can_omit_details_for_untracked_flags():
'on': False,
'offVariation': 1,
'variations': [ 'x', 'value3' ],
'debugEventsUntilDate': 1000
'debugEventsUntilDate': future_time
}
store = InMemoryFeatureStore()
store.init({ FEATURES: { 'key1': flag1, 'key2': flag2, 'key3': flag3 } })
@@ -275,7 +277,7 @@ def test_all_flags_state_can_omit_details_for_untracked_flags():
'key3': {
'variation': 1,
'version': 300,
'debugEventsUntilDate': 1000,
'debugEventsUntilDate': future_time,
'reason': {'kind': 'OFF'}
}
},