def tearDownClass(cls): if cls.client: # stop the flask server and the browser cls.client.get('http://localhost:4000/shutdown') cls.client.close() # destroy database db.drop_all() db.session.remove() # remove application context cls.app_context.pop()
def setUp(self): self.app = create_app('TESTING_CONFIG') self.app_context = self.app.app_context() self.app_context.push() db.drop_all() db.create_all() test_password = '******' Organization.insert_org() UserScope.insert_scopes() User.insert_user(password=test_password) self.client = self.app.test_client(use_cookies=False) self.basedir = os.path.abspath(os.path.dirname(__file__)) with open(self.basedir + '/mock_data/asset_post.json', 'r') as f: doc = json.load(f) self.asset_json_in = doc with open(self.basedir + '/mock_results/asset_from.json', 'r') as f: doc = json.load(f) self.asset_from_json = doc
def tearDown(self): db.session.remove() db.drop_all() self.app_context.pop()