Merge branch 'master' into dont-send-message-twice

Conflicts:
	tests/app/notifications/test_validators.py
This commit is contained in:
Rebecca Law
2016-11-29 12:34:33 +00:00
9 changed files with 215 additions and 35 deletions

View File

@@ -1,4 +1,3 @@
from datetime import datetime
import pytest
from freezegun import freeze_time
@@ -22,9 +21,10 @@ from tests.app.conftest import (
@pytest.mark.parametrize('key_type', ['team', 'normal'])
def test_exception_thrown_by_redis_store_get_should_not_be_fatal(
def test_exception_thown_by_redis_store_get_should_not_be_fatal(
notify_db,
notify_db_session,
notify_api,
key_type,
mocker):
mocker.patch('app.notifications.validators.redis_store.redis_store.get', side_effect=Exception("broken redis"))
@@ -39,8 +39,7 @@ def test_exception_thrown_by_redis_store_get_should_not_be_fatal(
assert e.value.status_code == 429
assert e.value.message == 'Exceeded send limits (4) for today'
assert e.value.fields == []
app.notifications.validators.redis_store.set\
.assert_called_with("{}-{}-count".format(service.id, datetime.utcnow().strftime("%Y-%m-%d")), 5, ex=3600)
assert app.notifications.validators.redis_store.set.called
@pytest.mark.parametrize('key_type', ['test', 'team', 'normal'])