예제 #1
0
def test__notify__recipient_type__push(mocker):
    log_mock = mocker.patch('dingdongditch.notifier.logger')
    notify_by_phone_mock = mocker.patch('dingdongditch.notifier.notify_by_phone')
    notify_by_push_mock = mocker.patch('dingdongditch.notifier.notify_by_push')

    notifier.notify('1234', 'asdf1234=', 2)

    notify_by_push_mock.assert_called_with('1234', 'asdf1234=')
    assert not notify_by_phone_mock.called
    assert not log_mock.error.called
예제 #2
0
def test__notify__recipient_type__unknown(mocker):
    log_mock = mocker.patch('dingdongditch.notifier.logger')
    notify_by_phone_mock = mocker.patch('dingdongditch.notifier.notify_by_phone')
    notify_by_push_mock = mocker.patch('dingdongditch.notifier.notify_by_push')

    result = notifier.notify('1234', 'o hai', 3)

    assert result is False
    assert log_mock.error.called
    assert not notify_by_phone_mock.called
    assert not notify_by_push_mock.called