Beispiel #1
0
def test_person2_dislikes_person1_parameters(mock_let_down):

    app = TindevQA()
    person1 = 'Luke'
    person2 = {'name': 'Leia', 'likes': ['Han Solo'], 'dislikes': ['Luke']}

    app.evaluate(person1, person2)

    mock_let_down.assert_called_once_with(person1)
Beispiel #2
0
def test_person2_dislikes_person1(mock_let_down):

    app = TindevQA()
    person1 = 'Luke'
    person2 = {'name': 'Leia', 'likes': ['Han Solo'], 'dislikes': ['Luke']}

    app.evaluate(person1, person2)

    assert mock_let_down.call_count == 1
def test_person2_dislikes_person1():

    app = TindevQA()
    person1 = 'Luke'
    person2 = {'name': 'Leia', 'likes': ['Han Solo'], 'dislikes': ['Luke']}
    when(app).let_down_gently(...)
    app.evaluate(person1, person2)

    verify(app, times=1).let_down_gently(...)
Beispiel #4
0
def test_person2_likes_person1(mock_send_mail):

    app = TindevQA()
    person1 = 'Han Solo'
    person2 = {'name': 'Leia', 'likes': ['Han Solo'], 'dislikes': ['Luke']}

    app.evaluate(person1, person2)

    person1_mail_received = mock_send_mail.call_args_list[0]
    person2_mail_received = mock_send_mail.call_args_list[1]
    assert person1_mail_received == call(person1)
    assert person2_mail_received == call(person2)
Beispiel #5
0
def test_person2_dislikes_person1_multiple_mocks(mock_let_down, mock_send_mail,
                                                 mock_give_it_time):

    app = TindevQA()
    person1 = 'Luke'
    person2 = {'name': 'Leia', 'likes': ['Han Solo'], 'dislikes': ['Luke']}

    app.evaluate(person1, person2)

    mock_let_down.assert_called_once_with(person1)
    assert mock_send_mail.call_count == 0
    assert mock_give_it_time.call_count == 0
def test_person2_likes_person1():

    app = TindevQA()
    person1 = 'Han Solo'
    person2 = {'name': 'Leia', 'likes': ['Han Solo'], 'dislikes': ['Luke']}

    when(app).send_email(...)

    app.evaluate(person1, person2)

    verify(app, times=2).send_email(...)
    verify(app, times=1).send_email(person1)
    verify(app, times=1).send_email(person2)
def test_person2_dislikes_person1_multiple_mocks():

    app = TindevQA()
    person1 = 'Luke'
    person2 = {'name': 'Leia', 'likes': ['Han Solo'], 'dislikes': ['Luke']}

    when(app).let_down_gently(person1)
    when(app).send_email(...)
    when(app).give_it_time(...)

    app.evaluate(person1, person2)
    verify(app, times=1).let_down_gently(person1)
    verify(app, times=0).send_email(...)
    verify(app, times=0).give_it_time(...)