

def test_post_with_user(self):
    data = {
        'name': 'test app',
        'description:': '',
        'download_url': 'http://example.com',
        'redirect_uris': 'http://example.com',
        'authorization_grant_type': 'password',
    }
    view = ApplicationCreate.as_view()
    url = reverse('admin:app_register')
    request = APIRequestFactory().post(url, data)
    request.user = UserFactory.create()
    from django.contrib.messages.storage.fallback import FallbackStorage
    setattr(request, 'session', 'session')
    messages = FallbackStorage(request)
    setattr(request, '_messages', messages)
    response = view(response)
    self.assertEqual(response.status_code, 302)
    self.assertEqual(Application.objects.count(), 1)

dataset/ETHPy150Open ExCiteS/geokey/geokey/applications/tests/test_views.py ApplicationCreateTest.test_post_with_user/VarMisuse@121/183 `request`->`response`