How to use the tomcatmanager.TomcatManager 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_manager.py View on Github external
def test_connect_no_url(self):
        tomcat = tm.TomcatManager()
        with pytest.raises(requests.exceptions.MissingSchema):
            r = tomcat.connect('')
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 / tests / test_manager.py View on Github external
def test_is_stream_primitives(self):
        assert not tm.TomcatManager()._is_stream(None)
        assert not tm.TomcatManager()._is_stream('some string')
        assert not tm.TomcatManager()._is_stream(['some', 'list'])
github tomcatmanager / tomcatmanager / tests / test_manager.py View on Github external
def test_connect_noauth(self, tomcat_manager_server):
        tomcat = tm.TomcatManager()
        r = tomcat.connect(tomcat_manager_server.url)
        assert isinstance(r, tm.models.TomcatManagerResponse)
        assert not tomcat.is_connected
        with pytest.raises(requests.exceptions.HTTPError):
            r.raise_for_status()
github tomcatmanager / tomcatmanager / tests / test_manager.py View on Github external
def test_is_stream_bytesio(self):
        fileobj = io.BytesIO(b'the contents of my warfile')
        assert tm.TomcatManager()._is_stream(fileobj)
github tomcatmanager / tomcatmanager / tests / test_manager.py View on Github external
def test_is_stream_fileobj(self, localwar_file):
        with open(localwar_file, 'rb') as localwar_fileobj:
            assert tm.TomcatManager()._is_stream(localwar_fileobj)
github tomcatmanager / tomcatmanager / src / tomcatmanager / interactive_tomcat_manager.py View on Github external
self.settable.update({'echo': 'For piped input, echo command to output'})
        self.settable.update({'status_to_stdout': 'Status information to stdout instead of stderr'})
        self.settable.update({'editor': 'Program used to edit files'})
        self.settable.update({'timeout': 'Seconds to wait for HTTP connections'})
        self.settable.update({'status_prefix': 'String to prepend to all status output'})
        self.settable.update({'debug': 'Show stack trace for exceptions'})
        self.prompt = '{}> '.format(self.app_name)
        self.shortcuts.update({'$?': 'exit_code'})

        self.appdirs = appdirs.AppDirs(self.app_name, self.app_author)

        super().__init__(persistent_history_file=self.history_file)

        self.load_config()

        self.tomcat = tm.TomcatManager()
        self.tomcat.timeout = self.timeout
        self.exit_code = None