Exemplo n.º 1
0
 def test_xmlrpc_with_legacy_key(self):
   self.overrides = test_util.override(API_ALLOW_LEGACY_AUTH=True)
   popular_ref = api.actor_get(api.ROOT, 'popular')
   personal_key = legacy.generate_personal_key(popular_ref)
   params = {'user': '******',
             'personal_key': personal_key,
             'nick': 'popular'}
   self.assert_valid_actor_get_response(params)
Exemplo n.º 2
0
 def test_xmlrpc_with_disabled_legacy_key(self):
   self.overrides = test_util.override(API_ALLOW_LEGACY_AUTH=False)
   popular_ref = api.actor_get(api.ROOT, 'popular')
   personal_key = legacy.generate_personal_key(popular_ref)
   params = {'user': '******',
             'personal_key': personal_key,
             'nick': 'popular'}
   xml = xmlrpclib.dumps((params,), 'actor_get')
   response = self.client.post('/api/xmlrpc', xml, 'text/xml')
   self.assertContains(response, 'Parameter not found')
Exemplo n.º 3
0
 def test_xmlrpc_with_legacy_key(self):
     self.overrides = test_util.override(API_ALLOW_LEGACY_AUTH=True)
     popular_ref = api.actor_get(api.ROOT, 'popular')
     personal_key = legacy.generate_personal_key(popular_ref)
     params = {
         'user': '******',
         'personal_key': personal_key,
         'nick': 'popular'
     }
     self.assert_valid_actor_get_response(params)
Exemplo n.º 4
0
 def test_xmlrpc_with_disabled_legacy_key(self):
     self.overrides = test_util.override(API_ALLOW_LEGACY_AUTH=False)
     popular_ref = api.actor_get(api.ROOT, 'popular')
     personal_key = legacy.generate_personal_key(popular_ref)
     params = {
         'user': '******',
         'personal_key': personal_key,
         'nick': 'popular'
     }
     xml = xmlrpclib.dumps((params, ), 'actor_get')
     response = self.client.post('/api/xmlrpc', xml, 'text/xml')
     self.assertContains(response, 'Parameter not found')
Exemplo n.º 5
0
def api_key_legacy(request):
  if not settings.API_ALLOW_LEGACY_AUTH:
    raise http.Http404()
  key = legacy.generate_personal_key(request.user)

  return http.HttpResponse(key)
Exemplo n.º 6
0
def api_key_legacy(request):
    if not settings.API_ALLOW_LEGACY_AUTH:
        raise http.Http404()
    key = legacy.generate_personal_key(request.user)

    return http.HttpResponse(key)