Exemple #1
0
 def test_users_can_login(self):
     response = self.client.post(url_for('login'),
                                 data={
                                     'email': User.email,
                                     'password': User.password
                                 })
     self.assertEqual(response.status_code, 302)
     self.assert_redirects(response, url_for('create_short'))
     db.session.remove()
     db.drop_all()
Exemple #2
0
def reset():
    if request.method == 'POST':
        r = request.json
        if 'password' in r.keys():
            if r['password'] == 'fangopass':
                with app.app_context():
                    db.drop_all()
                    db.create_all()
                    db.session.commit()
            else:
                return pass_needed()
        else:
            return pass_needed()

        return {'result': 'all clear'}, 200
Exemple #3
0
def load_dummy():
    if request.method == 'POST':
        r = request.json
        if 'password' in r.keys():
            if r['password'] == 'fangopass':
                with app.app_context():
                    db.drop_all()
                    db.create_all()
                    db.session.commit()

                    # with app.app_context():
                    load_dummy_on_db()

            else:
                return pass_needed()
        else:
            return pass_needed()

        return {'result': 'dummy loaded'}, 200
 def run(self, **kwargs):
     db.drop_all()
     db.create_all()
Exemple #5
0
 def teardown():
     _db.drop_all()
     os.unlink(TESTDB_PATH)
Exemple #6
0
 def teardown(self):
     db.session.remove()
     db.drop_all()
 def run(self, **kwargs):
     db.drop_all()
     db.create_all()