Пример #1
0
    def setUp(self, mock_open):

        mock_open.side_effect = [
            unittest.mock.mock_open(read_data='{"host": "redi.com"}').return_value
        ]

        self.app = service.build()
        self.api = self.app.test_client()
Пример #2
0
    def test_build(self, mock_open):

        mock_open.side_effect = [
            unittest.mock.mock_open(
                read_data='{"host": "redi.com"}').return_value
        ]

        app = service.build()

        self.assertEqual(app.name, "cnc-forge-api")

        mock_open.assert_has_calls(
            [unittest.mock.call("/opt/service/secret/redis.json", "r")])
Пример #3
0
    def test_app(self):

        app = service.build()

        self.assertEqual(app.name, "nandy-io-people-api")
        self.assertEqual(
            str(app.mysql.engine.url),
            "mysql+pymysql://root@nandyio-people-api-mysql:3306/nandy_people")

        self.assertEqual(app.logger.name, "nandy-io-people-api")

        self.assertLogged(
            app.logger,
            "debug",
            "init",
            extra={
                "init": {
                    "mysql": {
                        "connection":
                        "mysql+pymysql://root@nandyio-people-api-mysql:3306/nandy_people"
                    }
                }
            })
Пример #4
0
    def setUp(self):

        self.app = service.build()
        self.api = self.app.test_client()
Пример #5
0
    def test_build(self):

        app = service.build()

        self.assertEqual(app.name, "opengui-api")
Пример #6
0
    def setUpClass(cls):

        cls.app = service.build()
        cls.api = cls.app.test_client()
Пример #7
0
#!/usr/bin/env python

import service

service.build().run(host='0.0.0.0', port=80)