예제 #1
0
def test_get_temporary_file_login_required(tmp_file_data):
    with requests_mock.mock() as m:
        m.get('https://databasin.org/api/v1/uploads/temporary-files/1234/', status_code=401)

        c = Client()

        with pytest.raises(LoginRequiredError):
            tmp_file = c.get_temporary_file('1234')
예제 #2
0
def test_get_temporary_file_login_required(tmp_file_data):
    with requests_mock.mock() as m:
        m.get('https://databasin.org/api/v1/uploads/temporary-files/1234/',
              status_code=401)

        c = Client()

        with pytest.raises(LoginRequiredError):
            tmp_file = c.get_temporary_file('1234')
예제 #3
0
def test_get_temporary_file(tmp_file_data):
    with requests_mock.mock() as m:
        m.get('https://databasin.org/api/v1/uploads/temporary-files/1234/', text=json.dumps(tmp_file_data))

        c = Client()
        tmp_file = c.get_temporary_file('1234')

        assert m.called
        assert tmp_file.uuid == '1234'
예제 #4
0
def test_get_temporary_file(tmp_file_data):
    with requests_mock.mock() as m:
        m.get('https://databasin.org/api/v1/uploads/temporary-files/1234/',
              text=json.dumps(tmp_file_data))

        c = Client()
        tmp_file = c.get_temporary_file('1234')

        assert m.called
        assert tmp_file.uuid == '1234'