def setUp(self): os.environ[CONFIGMAP_FILE_ENVIRONMENT] = os.path.join( self.BASE_DIR, "config-tests-metrics.yml") ms = MyMicroservice(path=__file__) ms.reload_conf() self.app = ms.create_app() self.client = self.app.test_client()
def setUp(self): os.environ[CONFIGMAP_FILE_ENVIRONMENT] = os.path.join( os.path.dirname(os.path.abspath(__file__)), self.file1) ms = MyMicroservice(path=__file__) self.app = ms.create_app() self.client = self.app.test_client() self.assertEqual("reload1", self.app.config["APP_NAME"])
def setUp(self): os.environ[CONFIGMAP_FILE_ENVIRONMENT] = os.path.join(os.path.dirname(os.path.abspath(__file__)), "config-tests-flask-swagger.yml") ms = MyMicroservice(path=__file__) self.app = ms.create_app() self.client = self.app.test_client() self.assertEqual("Python Microservice With Flask", self.app.config["APP_NAME"])
def test_configfiles(payload, configfile, status_code): os.environ[CONFIGMAP_FILE_ENVIRONMENT] = os.path.join( os.path.dirname(os.path.abspath(__file__)), configfile) ms = MyMicroservice(path=__file__) ms.reload_conf() app = ms.create_app() client = app.test_client() response = client.get("/") assert payload == app.config["APP_NAME"] assert status_code == response.status_code