'fails if a login missing a refresh token, deletes the previously
saved refresh token. Systems such as google\'s oauth only send
a refresh token on first login.'

def test_account_refresh_token_saved_next_login(self):

    testemail = 'account_token@acme.com'
    testuser = user(username='user', is_active=True, email=testemail, password='test', save=True)
    email(user=testuser, email=testemail, primary=True, verified=True, save=True)
    token = 'access_token'
    refresh_token = 'refresh_token'
    app = self.ensure_github_app()
    sa = testuser.socialaccount_set.create(provider=app.provider)
    sa.socialtoken_set.create(app=app, token=token, token_secret=refresh_token)
    token_data = self.github_token_data.copy()
    token_data['access_token'] = token
    self.github_login(token_data=token_data, process='login')
    sa.refresh_from_db()
    social_token = sa.socialtoken_set.get()
    self.assertEqual(token, social_token.token)
    self.assertEqual(refresh_token, social_token.token_secret)
