def test_unauthorized_put(mock_put): mock_response = MagicMock() mock_response.status_code = 401 mock_put.return_value = mock_response url = 'http://example.com/foo' session = OSFSession() with pytest.raises(UnauthorizedException): session.put(url) mock_put.assert_called_once_with(url)
def test_put(mock_put): mock_response = MagicMock() mock_response.status_code = 200 mock_put.return_value = mock_response url = 'http://example.com/foo' session = OSFSession() response = session.put(url) assert response == mock_response mock_put.assert_called_once_with(url)