-
-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: remove social columns. Closes issue #2017 * refactor: remove unused code. * fix: ident problem. * refactor: remove unused code. * fix: remove unused test.
- Loading branch information
Showing
8 changed files
with
44 additions
and
162 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
alembic/versions/31c3c2ff9fab_drop_social_network_logins.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""drop social network logins | ||
Revision ID: 31c3c2ff9fab | ||
Revises: a791f9de9ac3 | ||
Create Date: 2021-02-27 10:17:17.122501 | ||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '31c3c2ff9fab' | ||
down_revision = 'a791f9de9ac3' | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
def upgrade(): | ||
op.drop_column('user', 'twitter_user_id') | ||
op.drop_column('user', 'google_user_id') | ||
op.drop_column('user', 'facebook_user_id') | ||
|
||
|
||
def downgrade(): | ||
op.add_column('user', sa.Column('twitter_user_id', sa.BigInteger, unique=True)) | ||
op.add_column('user', sa.Column('google_user_id', sa.BigInteger, unique=True)) | ||
op.add_column('user', sa.Column('facebook_user_id', sa.BigInteger, unique=True)) |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3444,19 +3444,6 @@ def test_delete_account_json(self, mock): | |
user = user_repo.filter_by(name='johndoe')[0] | ||
mock.assert_called_with(delete_account, user.id) | ||
|
||
@with_context | ||
def test_42_password_link(self): | ||
"""Test WEB visibility of password change link""" | ||
self.register() | ||
res = self.app.get('/account/johndoe/update') | ||
assert "Change your Password" in str(res.data) | ||
user = User.query.get(1) | ||
user.twitter_user_id = 1234 | ||
db.session.add(user) | ||
db.session.commit() | ||
res = self.app.get('/account/johndoe/update') | ||
assert "Change your Password" not in str(res.data), res.data | ||
|
||
@with_context | ||
def test_43_terms_of_use_and_data(self): | ||
"""Test WEB terms of use is working""" | ||
|
@@ -3635,12 +3622,7 @@ def test_45_password_reset_link_json(self, signer, queue, mock_url): | |
self.register(name='facebook') | ||
user = User.query.get(1) | ||
jane = User.query.get(2) | ||
jane.twitter_user_id = 10 | ||
google = User.query.get(3) | ||
google.google_user_id = 103 | ||
facebook = User.query.get(4) | ||
facebook.facebook_user_id = 104 | ||
db.session.add_all([jane, google, facebook]) | ||
db.session.add_all([jane]) | ||
db.session.commit() | ||
|
||
data = {'password': user.passwd_hash, 'user': user.name} | ||
|
@@ -3672,48 +3654,6 @@ def test_45_password_reset_link_json(self, signer, queue, mock_url): | |
|
||
resdata = json.loads(res.data) | ||
|
||
enqueue_call = queue.enqueue.call_args_list[1] | ||
assert send_mail == enqueue_call[0][0], "send_mail not called" | ||
assert 'your Twitter account to ' in enqueue_call[0][1]['body'] | ||
assert 'your Twitter account to ' in enqueue_call[0][1]['html'] | ||
err_msg = "There should be a flash message" | ||
assert resdata.get('flash'), err_msg | ||
assert "sent you an email" in resdata.get('flash'), err_msg | ||
|
||
data = {'password': google.passwd_hash, 'user': google.name} | ||
csrf = self.get_csrf('/account/forgot-password') | ||
res = self.app.post('/account/forgot-password', | ||
data=json.dumps({'email_addr': '[email protected]'}), | ||
follow_redirects=False, | ||
content_type="application/json", | ||
headers={'X-CSRFToken': csrf}) | ||
|
||
resdata = json.loads(res.data) | ||
|
||
enqueue_call = queue.enqueue.call_args_list[2] | ||
assert send_mail == enqueue_call[0][0], "send_mail not called" | ||
assert 'your Google account to ' in enqueue_call[0][1]['body'] | ||
assert 'your Google account to ' in enqueue_call[0][1]['html'] | ||
err_msg = "There should be a flash message" | ||
assert resdata.get('flash'), err_msg | ||
assert "sent you an email" in resdata.get('flash'), err_msg | ||
|
||
data = {'password': facebook.passwd_hash, 'user': facebook.name} | ||
csrf = self.get_csrf('/account/forgot-password') | ||
res = self.app.post('/account/forgot-password', | ||
data=json.dumps({'email_addr': '[email protected]'}), | ||
follow_redirects=False, | ||
content_type="application/json", | ||
headers={'X-CSRFToken': csrf}) | ||
|
||
enqueue_call = queue.enqueue.call_args_list[3] | ||
assert send_mail == enqueue_call[0][0], "send_mail not called" | ||
assert 'your Facebook account to ' in enqueue_call[0][1]['body'] | ||
assert 'your Facebook account to ' in enqueue_call[0][1]['html'] | ||
err_msg = "There should be a flash message" | ||
assert resdata.get('flash'), err_msg | ||
assert "sent you an email" in resdata.get('flash'), err_msg | ||
|
||
# Test with not valid form | ||
csrf = self.get_csrf('/account/forgot-password') | ||
res = self.app.post('/account/forgot-password', | ||
|
@@ -3763,16 +3703,9 @@ def test_45_password_reset_link(self, signer, queue): | |
|
||
self.register() | ||
self.register(name='janedoe') | ||
self.register(name='google') | ||
self.register(name='facebook') | ||
user = User.query.get(1) | ||
jane = User.query.get(2) | ||
jane.twitter_user_id = 10 | ||
google = User.query.get(3) | ||
google.google_user_id = 103 | ||
facebook = User.query.get(4) | ||
facebook.facebook_user_id = 104 | ||
db.session.add_all([jane, google, facebook]) | ||
db.session.add_all([jane]) | ||
db.session.commit() | ||
|
||
data = {'password': user.passwd_hash, 'user': user.name} | ||
|
@@ -3791,26 +3724,8 @@ def test_45_password_reset_link(self, signer, queue): | |
follow_redirects=True) | ||
enqueue_call = queue.enqueue.call_args_list[1] | ||
assert send_mail == enqueue_call[0][0], "send_mail not called" | ||
assert 'your Twitter account to ' in enqueue_call[0][1]['body'] | ||
assert 'your Twitter account to ' in enqueue_call[0][1]['html'] | ||
|
||
data = {'password': google.passwd_hash, 'user': google.name} | ||
self.app.post('/account/forgot-password', | ||
data={'email_addr': '[email protected]'}, | ||
follow_redirects=True) | ||
enqueue_call = queue.enqueue.call_args_list[2] | ||
assert send_mail == enqueue_call[0][0], "send_mail not called" | ||
assert 'your Google account to ' in enqueue_call[0][1]['body'] | ||
assert 'your Google account to ' in enqueue_call[0][1]['html'] | ||
|
||
data = {'password': facebook.passwd_hash, 'user': facebook.name} | ||
self.app.post('/account/forgot-password', | ||
data={'email_addr': '[email protected]'}, | ||
follow_redirects=True) | ||
enqueue_call = queue.enqueue.call_args_list[3] | ||
assert send_mail == enqueue_call[0][0], "send_mail not called" | ||
assert 'your Facebook account to ' in enqueue_call[0][1]['body'] | ||
assert 'your Facebook account to ' in enqueue_call[0][1]['html'] | ||
assert 'Click here to recover your account' in enqueue_call[0][1]['body'] | ||
assert 'To recover your password' in enqueue_call[0][1]['html'] | ||
|
||
# Test with not valid form | ||
res = self.app.post('/account/forgot-password', | ||
|