Beispiel #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')
Beispiel #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')
Beispiel #3
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)
Beispiel #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)
    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')
Beispiel #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')
Beispiel #7
0
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)
Beispiel #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)
Beispiel #9
0
def updated_avatar(request, user_id):
    update_user_details(user_id)
    hacker = Hacker.objects.get(user=user_id)
    return HttpResponse(hacker.avatar_url)
 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)