Show More
@@ -339,53 +339,3 b' class TestMyAccountController(TestContro' | |||||
339 | new_password_hash = response.session['rhodecode_user']['password'] |
|
339 | new_password_hash = response.session['rhodecode_user']['password'] | |
340 |
|
340 | |||
341 | assert old_password_hash != new_password_hash |
|
341 | assert old_password_hash != new_password_hash | |
342 |
|
||||
343 | def test_my_account_oauth_tokens_empty(self): |
|
|||
344 | usr = self.log_user('test_regular2', 'test12') |
|
|||
345 | User.get(usr['user_id']) |
|
|||
346 | response = self.app.get(url('my_account_oauth')) |
|
|||
347 | response.mustcontain(no=['Connect with GitHub']) |
|
|||
348 | response.mustcontain('You have no accounts linked yet') |
|
|||
349 |
|
||||
350 | def test_my_account_oauth_tokens_present(self): |
|
|||
351 | from rhodecode.model.db import ExternalIdentity |
|
|||
352 | usr = self.log_user('test_regular2', 'test12') |
|
|||
353 | user = User.get(usr['user_id']) |
|
|||
354 |
|
||||
355 | ex_identity = ExternalIdentity() |
|
|||
356 | ex_identity.external_id = '55' |
|
|||
357 | ex_identity.provider_name = 'twitter' |
|
|||
358 | ex_identity.local_user_id = user.user_id |
|
|||
359 | db_session = Session() |
|
|||
360 | db_session.add(ex_identity) |
|
|||
361 | Session.flush() |
|
|||
362 | db_session.commit() |
|
|||
363 | try: |
|
|||
364 | response = self.app.get(url('my_account_oauth')) |
|
|||
365 | response.mustcontain('twitter', |
|
|||
366 | no=['You have no accounts linked yet']) |
|
|||
367 | finally: |
|
|||
368 | db_session = Session() |
|
|||
369 | db_session.delete(ex_identity) |
|
|||
370 | db_session.commit() |
|
|||
371 |
|
||||
372 | def test_my_account_oauth_tokens_delete(self): |
|
|||
373 | from rhodecode.model.db import ExternalIdentity |
|
|||
374 | usr = self.log_user('test_regular2', 'test12') |
|
|||
375 | user = User.get(usr['user_id']) |
|
|||
376 |
|
||||
377 | ex_identity = ExternalIdentity() |
|
|||
378 | ex_identity.external_id = '99' |
|
|||
379 | ex_identity.provider_name = 'twitter' |
|
|||
380 | ex_identity.local_user_id = user.user_id |
|
|||
381 | db_session = Session() |
|
|||
382 | db_session.add(ex_identity) |
|
|||
383 | Session.flush() |
|
|||
384 | db_session.commit() |
|
|||
385 | assert ExternalIdentity.query().count() == 1 |
|
|||
386 | response = self.app.post( |
|
|||
387 | url('my_account_oauth', provider_name='twitter', |
|
|||
388 | external_id='99'), |
|
|||
389 | {'_method': 'delete', 'csrf_token': self.csrf_token}) |
|
|||
390 | assert_session_flash(response, 'OAuth token successfully deleted') |
|
|||
391 | assert ExternalIdentity.query().count() == 0 |
|
General Comments 0
You need to be logged in to leave comments.
Login now