Ejegg has uploaded a new change for review. https://gerrit.wikimedia.org/r/317044
Change subject: Merge branch 'master' into deploy ...................................................................... Merge branch 'master' into deploy f88eff8 Shuffle config usages around to be less of a jerk db39e0b Enable flake8 tests fcf1e6b Regression test for T143903 9411132 Tests for the bulk export 58da983 Fix python tests 7257815 Filter refunds out of donation history Change-Id: I0dfee19b05291bf9d64c0ba01f5cde458e3efe01 --- D queue/tests/test_redis_wrap.py 1 file changed, 0 insertions(+), 64 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools refs/changes/44/317044/1 diff --git a/queue/tests/test_redis_wrap.py b/queue/tests/test_redis_wrap.py deleted file mode 100644 index 5d3b7e7..0000000 --- a/queue/tests/test_redis_wrap.py +++ /dev/null @@ -1,64 +0,0 @@ -<<<<<<< HEAD (f6d200 Merge branch 'master' into deploy) -======= -import json -import mock -from queue.redis_wrap import Redis - -# TODO: -# Test source_meta - - -@mock.patch("redis.Redis") -@mock.patch("process.globals") -def test_send(MockGlobals, MockPyRedis): - ''' - Data is sent to the queue undisturbed. - ''' - MockGlobals.get_config.return_value.no_effect = False - MockGlobals.get_config.return_value.redis.queues = {} - - test_queue = "test_queue" - data = dict(a=2) - - Redis().send(test_queue, data) - - calls = MockPyRedis().rpush.mock_calls - assert len(calls) == 1 - # FIXME: indexen arcana. - actual_message_encoded = calls[0][1][1] - actual_msg = json.loads(actual_message_encoded) - assert actual_msg['a'] == 2 - - -@mock.patch("time.time") -@mock.patch("sys.argv") -@mock.patch("os.getpid") -@mock.patch("socket.gethostname") -@mock.patch("redis.Redis") -@mock.patch("process.globals") -def test_source_meta(MockGlobals, MockPyRedis, MockHostname, MockPid, MockArgv, MockTime): - ''' - Source meta fields are built correctly - ''' - MockGlobals.get_config.return_value.no_effect = False - MockGlobals.get_config.return_value.redis.queues = {} - MockHostname.return_value = "localhost-test" - MockPid.return_value = 123 - # Can't use __file__ because of .py vs .pyc on Python 2. - MockArgv.__getitem__.return_value = "test_redis_wrap" - MockTime.return_value = 1476388000 - - test_queue = "test_queue" - data = dict(a=1) - - expected = {"a": 1, "source_name": "test_redis_wrap", "source_version": "unknown", "source_enqueued_time": 1476388000, "source_host": "localhost-test", "source_run_id": 123, "source_type": "audit"} - - Redis().send(test_queue, data) - - calls = MockPyRedis().rpush.mock_calls - assert len(calls) == 1 - # FIXME: indexen arcana. - actual_message_encoded = calls[0][1][1] - actual_msg = json.loads(actual_message_encoded) - assert actual_msg == expected ->>>>>>> BRANCH (725781 Filter refunds out of donation history) -- To view, visit https://gerrit.wikimedia.org/r/317044 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0dfee19b05291bf9d64c0ba01f5cde458e3efe01 Gerrit-PatchSet: 1 Gerrit-Project: wikimedia/fundraising/tools Gerrit-Branch: deploy Gerrit-Owner: Ejegg <eeggles...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits