Ejemplo n.º 1
0
    def test_response_is_ok___info_is_logged(self):
        client = OasisAPIClient('http://localhost:8001', Mock())

        with responses.RequestsMock() as rsps:
            rsps.add(responses.DELETE, 'http://localhost:8001/foo', status=200)

            client.delete_resource('foo')

            client._logger.info.assert_called_with('Deleted http://localhost:8001/foo')
Ejemplo n.º 2
0
    def test_response_is_not_ok___warning_is_logged(self):
        client = OasisAPIClient('http://localhost:8001', Mock())

        with responses.RequestsMock() as rsps:
            rsps.add(responses.DELETE, 'http://localhost:8001/foo', status=400)

            client.delete_resource('foo')

            client._logger.warning.assert_called_with("DELETE http://localhost:8001/foo failed: 400")
Ejemplo n.º 3
0
    def test_delete_resource_is_called_with_the_correct_parameters(self):
        client = OasisAPIClient('http://localhost:8001')
        client.delete_resource = Mock()

        client.delete_exposure('foo')

        client.delete_resource.assert_called_once_with('/exposure/foo')