def f(domain, k, v, *a):
     if (domain, k, v) == ('', 'user_name', 'alice'):
         return UserInfo(
             platform='twitter', user_id='0', user_name='alice',
             is_team=False, domain=''
         )
     raise Exception
 def test_user_pages(self, get_user_info):
     for platform in self.platforms:
         alice = UserInfo(platform=platform.name, user_id='0',
                          user_name='alice', is_team=False, domain='')
         get_user_info.side_effect = lambda *a: alice
         response = self.client.GET('/on/%s/alice/' % platform.name)
         assert response.code == 200
 def make_elsewhere(self, platform, user_id, user_name, domain='', **kw):
     info = UserInfo(platform=platform,
                     user_id=str(user_id),
                     user_name=user_name,
                     domain=domain,
                     **kw)
     return AccountElsewhere.upsert(info)
Ejemplo n.º 4
0
 def test_upsert_correctly_updates_the_participant_avatar_url(self):
     alice = self.make_participant('alice')
     alice.update_avatar(src='libravatar:',
                         avatar_email='*****@*****.**')
     libravatar_url = alice.avatar_url
     assert libravatar_url
     alice_github_info = UserInfo(
         platform='github',
         user_id='1',
         user_name='alice',
         domain='',
         avatar_url='fake-github-avatar-url',
     )
     alice_github = AccountElsewhere.upsert(alice_github_info)
     alice.take_over(alice_github)
     alice = alice.refetch()
     assert alice.avatar_url == libravatar_url
     alice.update_avatar(src='github:')
     assert alice.avatar_url == 'fake-github-avatar-url'
     alice_github_info.avatar_url = 'new-fake-github-avatar-url'
     alice_github = AccountElsewhere.upsert(alice_github_info)
     assert alice_github.participant.avatar_url == 'new-fake-github-avatar-url'
Ejemplo n.º 5
0
 def test_user_pages(self, get_user_info):
     for platform in self.platforms:
         if platform.single_domain:
             domain, slug = '', 'alice'
         else:
             domain, slug = 'example.com', '*****@*****.**'
         alice = UserInfo(
             platform=platform.name, user_id='0', user_name='alice',
             is_team=False, domain=domain
         )
         get_user_info.side_effect = lambda *a: alice
         response = self.client.GET('/on/%s/%s/' % (platform.name, slug))
         assert response.code == 200
         self.db.run("DELETE FROM rate_limiting")