How to use the tomcatmanager.status_codes.fail 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_fail(tomcat, mock_text):
    mock_text.return_value = 'FAIL - some message'
    r = tomcat.vm_info()
    assert r.status_code == tm.status_codes.fail
    assert r.status_message == 'some message'
    assert r.result is None
github tomcatmanager / tomcatmanager / tests / test_manager_info.py View on Github external
def test_status_xml_fail(self, tomcat):
        with mock.patch('requests.models.Response.status_code', create=True,
                        new_callable=mock.PropertyMock) as mock_status:
            # chose a status value that won't raise an exception, but
            # that isn't 200, OK
            mock_status.return_value = 204 # No Content
            r = tomcat.status_xml()
            self.failure_assertions(r)
            assert r.status_code == tm.status_codes.fail
github tomcatmanager / tomcatmanager / tests / test_manager.py View on Github external
def failure_assertions(self, r):
        """
        Assertions for every command that should fail.
        """
        assert r.status_code == tm.status_codes.fail
        with pytest.raises(tm.TomcatError):
            r.raise_for_status()