def setUp(self): '''Setup test variables and remove form CSRF for easy submission''' app.testing = True app.config['WTF_CSRF_ENABLED'] = False app.config['NOMAIL'] = False app.config['NODB'] = True self.client = app.test_client()
def setUp(self): self.client = app.test_client() db.create_all() user = Users(username='******', email='*****@*****.**', password_hash='password') user.hash_password('password') bucketlist = BucketList( list_id='1', list_title='Going to the moon', list_description='I wish to have gone to the moon by 2015', created_by='1') bucketlist2 = BucketList( list_id='2', list_title='Learn 7 programming languages', list_description='Start studying ruby on the rails', created_by='1') bucketlistitems = BucketlistItem( item_id='1', item_title='Rocket', item_description= 'Request Mark Zucherberg to invest in modeling a rocket to take me to the moon', bucketlist_id='2', created_by='1') bucketlistitems2 = BucketlistItem( item_id='2', item_title='Travel equipment', item_description='Find the best equipment and clothes for travel', bucketlist_id='1', created_by='1') db.session.add(user) db.session.add(bucketlist) db.session.add(bucketlist2) db.session.add(bucketlistitems) db.session.add(bucketlistitems2) db.session.commit() self.user = {"username": "******", "password": "******"} response = self.client.post( '/auth/login', data=json.dumps(self.user), headers={'Content-Type': 'application/json'}) self.token = json.loads(response.get_data())['token']
def setUp(self): app.config['TESTING'] = True app.config['DEBUG'] = False self.app = app.test_client() self.assertEqual(app.debug, False)
def client(request): app.config['TESTING'] = True client = app.test_client() return client
def setUp(self): app.config['TESTING'] = True app.config['CSRF_ENABLED'] = False app.testing = True self.app = app.test_client()