

def test_post_with_anonymous(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 = AnonymousUser()
    response = view(request)
    self.assertEqual(response.status_code, 302)
    self.assertEqual(Application.objects.count(), 0)

dataset/ETHPy150Open ExCiteS/geokey/geokey/applications/tests/test_views.py ApplicationCreateTest.test_post_with_anonymous/original