Пример #1
0
    def test_me_ok(self):
        user = UsersFactory.create()
        url = reverse('api:me', )
        request = self.factory.get(url)
        request.user = user
        response = ApiMeView.as_view()(request)
        self.assertEqual(response.data['code'], 1)
        data_r = response.data['response']

        self.assertEqual(data_r['first_name'], user.first_name)
        self.assertEqual(data_r['last_name'], user.last_name)
        self.assertEqual(data_r['uid'], user.uid)
Пример #2
0
from django.conf.urls import url

from api.views import ApiFriendsView, ApiMeView

urlpatterns = [
    url(r'^friends/', ApiFriendsView.as_view(), name='friends'),
    url(r'^me/', ApiMeView.as_view(), name='me'),
]