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()
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")])
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" } } })
def setUp(self): self.app = service.build() self.api = self.app.test_client()
def test_build(self): app = service.build() self.assertEqual(app.name, "opengui-api")
def setUpClass(cls): cls.app = service.build() cls.api = cls.app.test_client()
#!/usr/bin/env python import service service.build().run(host='0.0.0.0', port=80)