Beispiel #1
0
def test_sort_by_priority(mocked_print, mocked_input, mocked_requests_get,
                          mocked_requests_post, mocked_requests_delete):
    with patch('builtins.open'):
        App().run()

    mocked_requests_post.assert_called()
    mocked_input.assert_called()
Beispiel #2
0
def test_exit(mocked_print, mocked_input):
    with patch('builtins.open'):
        App().run()
    mocked_print.assert_any_call('*** To Do List Login ***')
    mocked_print.assert_any_call('0:\tExit')
    mocked_print.assert_any_call('Bye!')
    mocked_input.assert_called()
Beispiel #3
0
def test_add_event(mocked_print, mocked_input, mocked_requests_get,
                   mocked_requests_post):
    with patch('builtins.open'):
        App().run()
    mocked_requests_post.assert_called()
    mocked_input.assert_called()
    mocked_print.assert_any_call('Event added!')
Beispiel #4
0
def test_register_user_common_password(mocked_print, mocked_input,
                                       mocked_requests_get,
                                       mocked_requests_post):
    with patch('builtins.open'):
        App().run()
    mocked_requests_post.assert_called()
    mocked_input.assert_called()
    mocked_print.assert_any_call('Something went wrong')
Beispiel #5
0
def test_wrong_credentials(mocked_print, mocked_input, mocked_requests_get,
                           mocked_requests_post):
    with patch('builtins.open'):
        App().run()
    mocked_print.assert_any_call('*** To Do List Login ***')
    mocked_requests_post.assert_called()
    mocked_input.assert_called()
    mocked_print.assert_any_call('Wrong Credentials!')
Beispiel #6
0
def test_remove_event(mocked_print, mocked_input, mocked_requests_get,
                      mocked_requests_post, mocked_requests_delete):
    with patch('builtins.open'):
        App().run()
    mocked_requests_post.assert_called()
    mocked_input.assert_called()
    mocked_requests_delete.assert_called()
    mocked_print.assert_any_call('Event removed')
Beispiel #7
0
def test_logout_wrong(mocked_print, mocked_input, mocked_requests_get,
                      mocked_requests_post):
    with patch('builtins.open'):
        App().run()
    mocked_requests_post.assert_called()
    mocked_input.assert_called()
    mocked_requests_get.assert_called_with(
        url='http://localhost:8000/api/v1/events',
        headers={
            'Authorization': 'Token 301ed42f7db4a71b682716f7b3e351a2dd10c459'
        })
    mocked_print.assert_any_call('Log out failed')