Пример #1
0
    def test_start_service_do_nothing_if_no_in_heroku(self):

        os.environ['PYTHONHOME'] = ''
        service = herokuservice.HerokuService()
        service.allowed = True
        service.startService()
        self.assertFalse(service.running)
Пример #2
0
    def test_start_service(self):

        service = herokuservice.HerokuService()
        service.allowed = True
        service.startService()
        self.assertTrue(service.running)
        service.stopService()
Пример #3
0
    def test_start_runs_looping_call(self):

        service = herokuservice.HerokuService()
        service.allowed = True
        service.startService()
        self.assertTrue(service.ping_task.running)
        service.stopService()
Пример #4
0
    def test_stop_service_do_nothing_if_not_started(self):
        class FakeTask(object):

            called = False

            def stop(self, value):
                self.called = True

        service = herokuservice.HerokuService()
        service.allowed = True
        service.ping_task = FakeTask()
        service.stopService()
        self.assertFalse(service.ping_task.called)
Пример #5
0
    def test_start_service_do_nothing_if_not_force_heroku_awake_config(self):

        service = herokuservice.HerokuService()
        service.allowed = False
        service.startService()
        self.assertFalse(service.running)
Пример #6
0
    def test_ping_do_nothing_if_no_heroku_url_is_configured(self):

        service = herokuservice.HerokuService()
        self.assertNotIsInstance(service.ping(), Deferred)