def init_db(port, domain_name): db.create_all() user = User(username='******') user.set_password('ada') db.session.add(user) config = { 'name': 'test', 'participants': [{ 'name': f'{domain_name}', 'url': f'127.0.0.1:{port}', 'domain_name': f'{domain_name}', 'grpc_spec': { 'authority': f'{domain_name[:-4]}-client-auth.com' } }], 'variables': [{ 'name': 'namespace', 'value': 'default' }, { 'name': 'storage_root_dir', 'value': '/data' }, { 'name': 'EGRESS_URL', 'value': f'127.0.0.1:{port}' }] } project = Project(name='test', config=ParseDict( config, project_pb2.Project()).SerializeToString()) db.session.add(project) db.session.commit()
def setUp(self): db.create_all() user = User(username='******') user.set_password('ada') db.session.add(user) db.session.commit() self.signin_helper()
def setUp(self): try: # keep clean database before each test os.remove(test_db_path) except OSError: pass db.create_all() initial_db() self.signin_helper()
def create_db(): db.create_all() user = User(username='******') user.set_password('ada') db.session.add(user) db.session.commit()