pytest: Remove oauth related tests.

This commit is contained in:
Johannes Bornhold 2016-05-25 13:38:59 +02:00
parent a06fbea01c
commit 16c3f13f3e

View file

@ -339,53 +339,3 @@ class TestMyAccountController(TestController):
new_password_hash = response.session['rhodecode_user']['password']
assert old_password_hash != new_password_hash
def test_my_account_oauth_tokens_empty(self):
usr = self.log_user('test_regular2', 'test12')
User.get(usr['user_id'])
response = self.app.get(url('my_account_oauth'))
response.mustcontain(no=['Connect with GitHub'])
response.mustcontain('You have no accounts linked yet')
def test_my_account_oauth_tokens_present(self):
from rhodecode.model.db import ExternalIdentity
usr = self.log_user('test_regular2', 'test12')
user = User.get(usr['user_id'])
ex_identity = ExternalIdentity()
ex_identity.external_id = '55'
ex_identity.provider_name = 'twitter'
ex_identity.local_user_id = user.user_id
db_session = Session()
db_session.add(ex_identity)
Session.flush()
db_session.commit()
try:
response = self.app.get(url('my_account_oauth'))
response.mustcontain('twitter',
no=['You have no accounts linked yet'])
finally:
db_session = Session()
db_session.delete(ex_identity)
db_session.commit()
def test_my_account_oauth_tokens_delete(self):
from rhodecode.model.db import ExternalIdentity
usr = self.log_user('test_regular2', 'test12')
user = User.get(usr['user_id'])
ex_identity = ExternalIdentity()
ex_identity.external_id = '99'
ex_identity.provider_name = 'twitter'
ex_identity.local_user_id = user.user_id
db_session = Session()
db_session.add(ex_identity)
Session.flush()
db_session.commit()
assert ExternalIdentity.query().count() == 1
response = self.app.post(
url('my_account_oauth', provider_name='twitter',
external_id='99'),
{'_method': 'delete', 'csrf_token': self.csrf_token})
assert_session_flash(response, 'OAuth token successfully deleted')
assert ExternalIdentity.query().count() == 0