Esempio n. 1
0
def test_task_creation(ts):
    api = MyAPI()
    api._start()

    assert ts.call_count == 1
    assert ts.return_value.post_task.call_count == 1
    first_args = ts.return_value.post_task.call_args

    ts.reset_mock()
    api._start()
    assert ts.call_count == 1
    assert ts.return_value.post_task.call_count == 1
    second_args = ts.return_value.post_task.call_args

    assert first_args != second_args
Esempio n. 2
0
def test_index_page():
    api = MyAPI()
    api._start = mock.Mock()
    api._check = mock.Mock()

    api.index()
    api._start.assert_called_once_with()

    api.index('asdf')
    api._check.assert_called_once_with('asdf')