How to use the tomcatmanager.status_codes.ok function in tomcatmanager

To help you get started, we’ve selected a few tomcatmanager examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tomcatmanager / tomcatmanager / tests / test_models.py View on Github external
def test_http_response_valid(tomcat, mock_text):
    mock_text.return_value = 'OK - some message\nthe result'
    r = tomcat.vm_info()
    assert r.status_code == tm.status_codes.ok
    assert r.status_message == 'some message'
    assert r.result == 'the result'
github tomcatmanager / tomcatmanager / tests / test_manager.py View on Github external
def test_connect_auth(self, tomcat_manager_server):
        tomcat = tm.TomcatManager()
        r = tomcat.connect(
            tomcat_manager_server.url,
            tomcat_manager_server.user,
            tomcat_manager_server.password
        )
        assert isinstance(r, tm.models.TomcatManagerResponse)
        assert r.status_code == tm.status_codes.ok
        assert tomcat.is_connected
        assert r.result == ''
        assert r.status_message == ''
        r.raise_for_status()
github tomcatmanager / tomcatmanager / src / tomcatmanager / models.py View on Github external
def raise_for_status(self):
        """
        Raise exceptions for server errors.

        First call `requests.Response.raise_for_status()` which
        raises exceptions if a 4xx or 5xx response is received from the
        server.

        If that doesn't raise anything, then raise a `TomcatError`
        if there is not an ``OK`` response from the first line of text back
        from the Tomcat Manager web app.
        """
        self.response.raise_for_status()
        if self.status_code != tm.status_codes.ok:
            raise TomcatError(self.status_message)