Esempio n. 1
0
 def test_basic(self):
     """Create a flacon from a name."""
     g = flacon.Flacon(__name__, registry=self.registry)
     testutils.setup(g)
     g.setup()
     self.assertIsNotNone(g)
     self.assertTrue(g.is_healthy())
     self.assertTrue(g.is_ready())
     self.assertIsNotNone(g.metrics)
Esempio n. 2
0
    def test_logging_should_be_enabled_by_default(self):
        logger = mockito.mock()
        app = flask.Flask(__name__)
        app.logger = logger

        g = flacon.Flacon(app, registry=self.registry)

        testutils.setup(g, [])

        mockito.verify(logger, times=1).addHandler(mockito.any())
        mockito.verify(logger, times=1).setLevel(mockito.any())
        mockito.verify(logger, times=1).info("Logging initialized.")
Esempio n. 3
0
    def test_disable_embedded_logging_should_prevent_logging_from_being_configured(
            self):
        logger = mockito.mock()
        app = flask.Flask(__name__)
        app.logger = logger

        g = flacon.Flacon(app, registry=self.registry)

        testutils.setup(g, ["--disable-embedded-logging"])

        mockito.verify(logger, times=0).addHandler(mockito.any())
        mockito.verify(logger, times=0).setLevel(mockito.any())
Esempio n. 4
0
 def setUp(self):
     testutils.setup(app.flacon)
     self.app = app.app.test_client()
Esempio n. 5
0
 def test_flask(self):
     """Create a flacon with a flask."""
     app = flask.Flask(__name__)
     g = flacon.Flacon(app, registry=self.registry)
     testutils.setup(g)
     self.assertIsNotNone(g)