def test_sse_reconnect(server, stream): server.post_events() stream.queue.put(Event(event="put", data=feature("foo", "on"))) client = LDClient("apikey", TwistedConfig(stream=True, base_uri=server.url, stream_uri=stream.url)) yield wait_until(is_equal(lambda: client.toggle("foo", user('xyz'), "blah"), "on")) stream.stop() yield wait_until(is_equal(lambda: client.toggle("foo", user('xyz'), "blah"), "on")) stream.start() stream.queue.put(Event(event="put", data=feature("foo", "jim"))) client = LDClient("apikey", TwistedConfig(stream=True, base_uri=server.url, stream_uri=stream.url)) yield wait_until(is_equal(lambda: client.toggle("foo", user('xyz'), "blah"), "jim"))
def test_sse_init(stream): stream.queue.put(Event(event="put", data=feature("foo", "jim"))) client = LDClient( "apikey", TwistedConfig(stream=True, stream_processor_class=create_redis_ldd_processor, feature_requester_class=NoOpFeatureRequester, events=False)) yield wait_until( is_equal(lambda: client.toggle("foo", user('xyz'), "blah"), "jim"))
def test_toggle(server): server.add_feature("foo", feature("foo", "jim")['foo']) client = TwistedLDClient("apikey", TwistedConfig(base_uri=server.url)) yield wait_until(is_equal(lambda: client.toggle("foo", user('xyz'), "blah"), "jim"))
def test_sse_init(stream): stream.queue.put(Event(event="put", data=feature("foo", "jim"))) client = LDClient("apikey", TwistedConfig(stream=True, stream_processor_class=create_redis_ldd_processor, feature_requester_class=NoOpFeatureRequester, events=False)) yield wait_until(is_equal(lambda: client.toggle("foo", user('xyz'), "blah"), "jim"))