Created
February 13, 2020 20:08
-
-
Save Porter97/52f7394ea5be2419d6127519ed7de5d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#... | |
import stream | |
from flask import current_app | |
#... | |
class UserModelTestCase(unittest.TestCase): | |
#... | |
def test_valid_confirmation_token(self): | |
client = stream.connect(current_app.config['STREAM_API_KEY'], current_app.config['STREAM_SECRET']) | |
u = User(id=9999999999, username='john', email='john@example.com', password='test') | |
db.session.add(u) | |
db.session.commit() | |
token = u.generate_confirmation_token() | |
self.assertTrue(u.confirm(token)) | |
client.users.delete(str(u.id)) | |
#... | |
def test_valid_email_change_token(self): | |
client = stream.connect(current_app.config['STREAM_API_KEY'], current_app.config['STREAM_SECRET']) | |
u = User(id=9999999999, username='john', email='john@example.com', password='test') | |
db.session.add(u) | |
db.session.commit() | |
confirm_token = u.generate_confirmation_token() | |
email_token = u.generate_email_change_token('john@example.org') | |
self.assertTrue(u.confirm(confirm_token)) | |
self.assertTrue(u.change_email(email_token)) | |
self.assertTrue(u.email == 'john@example.org') | |
client.users.delete(str(u.id)) | |
#... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment