def setUp(self):
        super(TestWebUIServer, self).setUp()

        director = Mock()
        scheduler = Mock()

        self.wui_api = WebUIAPI(self.config, director, scheduler)
Exemple #2
0
    def startService(self):
        service.MultiService.startService(self)

        web_ui_api = WebUIAPI(config, self.director, self.scheduler)
        self._port = reactor.listenTCP(self.port_number,
                                       server.Site(web_ui_api.app.resource()),
                                       interface=config.advanced.webui_address)
    def setUp(self):
        super(TestWebUIServer, self).setUp()

        director = Mock()
        scheduler = Mock()

        self.wui_api = WebUIAPI(self.config, director, scheduler)
class TestWebUIServer(ConfigTestCase):
    def setUp(self):
        super(TestWebUIServer, self).setUp()

        director = Mock()
        scheduler = Mock()

        self.wui_api = WebUIAPI(self.config, director, scheduler)

    def tearDown(self):
        super(TestWebUIServer, self).tearDown()
        self.wui_api.status_poller.stop()
        self.wui_api.director_event_poller.stop()

    def test_api_status(self):
        request = Mock()
        resp = self.wui_api.api_status(request)
        j = json.loads(resp)
        expected_keys = ["software_version", "software_name", "asn",
                         "country_code", "director_started", "initialized",
                         "quota_warning"]
        for key in expected_keys:
            self.assertTrue(key in j)
class TestWebUIServer(ConfigTestCase):
    def setUp(self):
        super(TestWebUIServer, self).setUp()

        director = Mock()
        scheduler = Mock()

        self.wui_api = WebUIAPI(self.config, director, scheduler)

    def tearDown(self):
        super(TestWebUIServer, self).tearDown()
        self.wui_api.status_poller.stop()
        self.wui_api.director_event_poller.stop()

    def test_api_status(self):
        request = Mock()
        resp = self.wui_api.api_status(request)
        j = json.loads(resp)
        expected_keys = [
            "software_version", "software_name", "asn", "country_code",
            "director_started", "initialized", "quota_warning"
        ]
        for key in expected_keys:
            self.assertTrue(key in j)