コード例 #1
0
    def test_updates_user_details(self):
        # When
        self.client.get('/complete/hackerschool/')
        user = User.objects.get(email=self.USER_DATA['email'])
        self.USER_DATA['twitter'] = 'johndoe'

        # When
        update_user_details(self.USER_DATA['id'], user)

        # Then
        user = User.objects.get(email=self.USER_DATA['email'])
        self.assertEqual(user.hacker.twitter, 'johndoe')
コード例 #2
0
    def test_updates_user_details(self):
        # When
        self.client.get('/complete/hackerschool/')
        user = User.objects.get(email=self.USER_DATA['email'])
        self.USER_DATA['twitter'] = 'johndoe'

        # When
        update_user_details(self.USER_DATA['id'], user)

        # Then
        user = User.objects.get(email=self.USER_DATA['email'])
        self.assertEqual(user.hacker.twitter, 'johndoe')
コード例 #3
0
ファイル: views.py プロジェクト: vhf/blaggregator
def updated_avatar(request, user_id):
    try:
        Hacker.objects.get(user=user_id)

    except Hacker.DoesNotExist:
        raise Http404

    else:
        update_user_details(user_id, request.user)
        hacker = Hacker.objects.get(user=user_id)

    return HttpResponse(hacker.avatar_url)
コード例 #4
0
def updated_avatar(request, user_id):
    try:
        Hacker.objects.get(user=user_id)

    except Hacker.DoesNotExist:
        raise Http404

    else:
        update_user_details(user_id, request.user)
        hacker = Hacker.objects.get(user=user_id)

    return HttpResponse(hacker.avatar_url)
コード例 #5
0
    def test_updates_user_details(self):
        # When
        self.client.get('/complete/hackerschool/')
        user = User.objects.get(email=self.USER_DATA['email'])
        self.USER_DATA['twitter'] = 'johndoe'

        # When
        with patch('requests.get', new=lambda url: request(None, url)):
            update_user_details(self.USER_DATA['id'])

        # Then
        user = User.objects.get(email=self.USER_DATA['email'])
        self.assertEqual(user.hacker.twitter, 'johndoe')
コード例 #6
0
    def test_updates_user_details(self):
        # When
        self.client.get('/complete/hackerschool/')
        user = User.objects.get(email=self.USER_DATA['email'])
        self.USER_DATA['twitter'] = 'johndoe'

        # When
        with patch('requests.get', new=lambda url: request(None, url)):
            update_user_details(self.USER_DATA['id'])

        # Then
        user = User.objects.get(email=self.USER_DATA['email'])
        self.assertEqual(user.hacker.twitter, 'johndoe')
コード例 #7
0
ファイル: views.py プロジェクト: strugee/blaggregator
def updated_avatar(request, user_id):
    update_user_details(user_id, request.user)
    hacker = Hacker.objects.get(user=user_id)
    return HttpResponse(hacker.avatar_url)
コード例 #8
0
 def handle(self, **options):
     users = User.objects.exclude(hacker=None)
     log.debug('Updating %s users', users.count())
     for user_id in users.values_list('id', flat=True):
         log.debug('Updating user: %s', user_id)
         update_user_details(user_id)
コード例 #9
0
ファイル: views.py プロジェクト: davidbalbert/blaggregator
def updated_avatar(request, user_id):
    update_user_details(user_id)
    hacker = Hacker.objects.get(user=user_id)
    return HttpResponse(hacker.avatar_url)
コード例 #10
0
 def handle(self, **options):
     users = User.objects.exclude(hacker=None)
     log.debug('Updating %s users', users.count())
     for user_id in users.values_list('id', flat=True):
         log.debug('Updating user: %s', user_id)
         update_user_details(user_id)