Esempio n. 1
0
def test_vxcubeapi_login_bad_response():
    request = mock.Mock(return_value=("bad"))
    with mock.patch("vxcube_api.raw_api.VxCubeApiRequest.request",
                    new=request):
        api = VxCubeApi(base_url="http://test", version=2.0)
        with pytest.raises(VxCubeApiException):
            api.login("login", "password")

    request.assert_called_with(method="post",
                               url="http://test/api-2.0/login",
                               params={},
                               headers={},
                               json={
                                   "login": "******",
                                   "password": "******",
                                   "new_key": False
                               })