Created
March 2, 2020 20:36
-
-
Save Porter97/e478f360fab4e3a4b285393089402da7 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
#... | |
class UserModelTestCase(unittest.TestCase): | |
#... | |
def test_follows(self): | |
client = stream.connect(current_app.config['STREAM_API_KEY'], current_app.config['STREAM_SECRET']) | |
u1 = User(id=9999999999, username='john', email='john@example.com', password='test') | |
u2 = User(id=9999999998, username='mary', email='mary@example.org', password='test1') | |
db.session.add(u1) | |
db.session.add(u2) | |
db.session.commit() | |
token1 = u1.generate_confirmation_token() | |
token2 = u2.generate_confirmation_token() | |
self.assertTrue(u1.confirm(token1)) | |
self.assertTrue(u2.confirm(token2)) | |
self.assertFalse(u2.is_following(u1)) | |
u2.follow(u1) | |
db.session.commit() | |
self.assertTrue(u2.is_following(u1)) | |
self.assertTrue(u2.unfollow(u1)) | |
client.users.delete(str(u1.id)) | |
client.users.delete(str(u2.id)) | |
db.session.commit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment