How to use the tomcatmanager.status_codes.notfound 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_not_tomcat(tomcat, mock_text, content):
    # like we might get if they put a regular web page in for the URL
    mock_text.return_value = content
    r = tomcat.vm_info()
    assert r.status_code == tm.status_codes.notfound
    assert r.status_message == 'Tomcat Manager not found'
    assert r.result is None
github tomcatmanager / tomcatmanager / src / tomcatmanager / models.py View on Github external
self._response = response
        # parse the text to get the status code and results
        if response.text:
            lines = response.text.splitlines()
            # get the status line, if the request completed OK
            if response.status_code == requests.codes.ok:
                try:
                    statusline = response.text.splitlines()[0]
                    code = statusline.split(' ', 1)[0]
                    if code in tm.status_codes.values():
                        self.status_code = code
                        self.status_message = statusline.split(' ', 1)[1][2:]
                        if len(lines) > 1:
                            self.result = "\n".join(lines[1:])
                    else:
                        self.status_code = tm.status_codes.notfound
                        self.status_message = 'Tomcat Manager not found'
                except IndexError:
                    pass