Skip to content

Commit

Permalink
Comply with RFC5785
Browse files Browse the repository at this point in the history
According to section 3.6.7, to comply with the RFC5785 we should
implement the query interface functionality under the authrority
path "/.well-known/org/ogf/occi/-/".
  • Loading branch information
alvarolopez committed Apr 17, 2015
1 parent 2675a8c commit a8d4178
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ooi/tests/middleware/test_query_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@ def test_query(self):
self.assertExpectedResult(fakes.fake_query_results(), result)
self.assertEqual(200, result.status_code)

def test_query_rfc(self):
tenant_id = fakes.tenants["bar"]["id"]
result = self._build_req("/.well-known/org/ogf/occi/-/",
tenant_id).get_response(self.get_app())
self.assertDefaults(result)
self.assertExpectedResult(fakes.fake_query_results(), result)
self.assertEqual(200, result.status_code)

def test_query_rfc_equal(self):
tenant_id = fakes.tenants["bar"]["id"]
result_rfc = self._build_req("/.well-known/org/ogf/occi/-/",
tenant_id).get_response(self.get_app())
result_query = self._build_req("/-/",
tenant_id).get_response(self.get_app())
self.assertDefaults(result_rfc)
self.assertDefaults(result_query)
self.assertEqual(result_rfc.text, result_query.text)


class QueryControllerTextPlain(test_middleware.TestMiddlewareTextPlain,
TestQueryController):
Expand Down
4 changes: 4 additions & 0 deletions ooi/wsgi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ def index(self, *args, **kwargs):
self.mapper.connect("query", "/-/",
controller=self.resources["query"],
action="index")
# RFC5785, OCCI section 3.6.7
self.mapper.connect("query", "/.well-known/org/ogf/occi/-/",
controller=self.resources["query"],
action="index")

self.resources["compute"] = self._create_resource(
ooi.api.compute.Controller)
Expand Down

0 comments on commit a8d4178

Please sign in to comment.