Commit ec9d59e0 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Implement show extension API endpoint

Dummy implementation of /extensions/<alias> endpoint that always returns
404.
parent 0cae6738
......@@ -43,6 +43,7 @@ log = getLogger(__name__)
urlpatterns = patterns(
'synnefo.api.extensions',
(r'^(?:/|.json|.xml)?$', 'demux'),
(r'^/([\w-]+)(?:/|.json|.xml)?$', 'demux_extension'),
)
......@@ -53,8 +54,20 @@ def demux(request):
return api.api_method_not_allowed(request)
def demux_extension(request, extension_alias):
if request.method == 'GET':
return get_extension(request, extension_alias)
else:
return api.api_method_not_allowed(request)
@api.api_method(http_method='GET', user_required=True, logger=log)
def list_extensions(request, detail=False):
# Temporary return empty list. This will return the SNF: extension.
data = json.dumps(dict(extensions=[]))
return HttpResponse(data, status=200)
@api.api_method(http_method='GET', user_required=True, logger=log)
def get_extension(request, extension_alias):
return HttpResponse(status=404)
......@@ -44,8 +44,16 @@ EXTENSIONS_URL = join_urls(COMPUTE_URL, "extensions/")
class ExtensionsAPITest(BaseAPITest):
def test_001(self):
def test_list(self):
response = self.get(EXTENSIONS_URL, "user")
self.assertSuccess(response)
extensions = json.loads(response.content)["extensions"]
self.assertEqual(extensions, [])
def test_get(self):
response = self.get(join_urls(EXTENSIONS_URL, "SNF"), "user")
self.assertEqual(response.status_code, 404)
response = self.get(join_urls(EXTENSIONS_URL, "SNF_asfas_da"), "user")
self.assertEqual(response.status_code, 404)
response = self.get(join_urls(EXTENSIONS_URL, "SNF-AD"), "user")
self.assertEqual(response.status_code, 404)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment