Esempio n. 1
0
    def test_admins_unlock(self, loggedin_client):
        test_admin = Admins().from_json({
            'username': '******',
            'password': '******',
            'name': 'Test Admin'
        })
        test_admin.failed_attempts = 5
        test_admin.last_failed_date = datetime.utcnow()
        test_admin.unlock_date = datetime.utcnow() + timedelta(minutes=30)

        db.session.add(test_admin)
        db.session.commit()

        new_test_admin = Admins.query.filter_by(username='******').one()
        rv = loggedin_client.put("/api/v1/admins/unlock/{0}".format(new_test_admin.id), follow_redirects=True)
        assert rv.status_code == 200