Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(5)  |  Call(5)  |  Derive(0)  |  Import(0)

src/p/o/portfoliyo-HEAD/portfoliyo/tests/notifications/test_record.py   portfoliyo(Download)
def test_record(mock_store):
    """Passes notification data on to ``store``."""
    record._record(
        _profile(id=2), 'some', triggering=False, data={'foo': 'bar'})
 
def test_record_triggering(mock_store):
    """If triggering, triggers send_notification task."""
    tgt = 'portfoliyo.notifications.record.tasks.send_notification_email.delay'
    with mock.patch(tgt) as mock_task_delay:
        record._record(_profile(id=2), 'some', triggering=True)
        with mock.patch(tgt) as mock_task_delay:
            mock_settings.NOTIFICATION_EMAILS = False
            record._record(_profile(id=2), 'some', triggering=True)
 
    assert mock_task_delay.call_count == 0
def test_record_doesnt_store_if_user_inactive(mock_store):
    """Doesn't store notifications for inactive users."""
    record._record(_profile(id=2, is_active=False), 'some')
 
    assert not mock_store.call_count
def test_record_doesnt_store_if_no_email(mock_store):
    """Doesn't store notifications for users without email addresses."""
    record._record(_profile(id=2, email=None), 'some')
 
    assert not mock_store.call_count