def setUp(self): app.config['TESTING'] = True app.config['WTF_CSRF_ENABLED'] = False app.config['DEBUG'] = False self.app = app.test_client() DATABASE.connect() DATABASE.create_tables([User, ToDo], safe=True) try: self.user1 = User.create_user( username='******', email='*****@*****.**', password='******' ) except: pass try: with open('mock/todos.json') as mocktodos: json_reader = json.load(mocktodos) for todo in json_reader: ToDo.create( created_by=1, **todo ) except Exception as err: print(err) pass