Skip to content
This repository has been archived by the owner on Nov 28, 2023. It is now read-only.

Commit

Permalink
added operational info
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorasm committed Feb 1, 2015
1 parent e52f8a6 commit 027a86f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion exampleProject/exampleApi/resources/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import projects
import projects, operationalInfo
10 changes: 10 additions & 0 deletions exampleProject/exampleApi/resources/operationalInfo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from paperThinRest.httpLayer import registerResource

registerResource('/operational-info/',__name__)


def getItem(itemId):
if itemId=='ping':
return {'pong':True}

return None
9 changes: 9 additions & 0 deletions exampleProject/tests/testOperationalInfo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from tests import testsSetup
testsSetup

from paperThinRest.test.baseRestTestCase import BaseRestTestCase
class Test(BaseRestTestCase):

def testPing(self):
data = self.expect(status=200).get('/operational-info/ping').json
self.assertEqual(data, {'pong':True})
3 changes: 1 addition & 2 deletions paperThinRest/paperThinRest/httpLayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def getModuleMethod(name,defaultValue=None):
mapToResource = getModuleMethod('mapToResource')
if mapToResource is None:
mapToResource = lambda thing: thing # a passthrough default implementation



createItem = getModuleMethod('createItem')
if createItem is not None:
def httpCreateItem():
Expand Down

0 comments on commit 027a86f

Please sign in to comment.