Browse Source

change the paths to be a bit more hierarchical

main
John-Mark Gurney 4 years ago
parent
commit
5586a6132b
1 changed files with 7 additions and 7 deletions
  1. +7
    -7
      bitelab/__init__.py

+ 7
- 7
bitelab/__init__.py View File

@@ -193,12 +193,12 @@ def board_priority(request: Request):
scope = request.scope
return scope['server']

@router.get('/board_classes', response_model=Dict[str, BoardClassInfo])
@router.get('/board/classes', response_model=Dict[str, BoardClassInfo])
async def foo(user: str = Depends(lookup_user),
brdmgr: BoardManager = Depends(get_boardmanager)):
return brdmgr.classes()

@router.get('/board_info',response_model=Dict[str, Board])
@router.get('/board/',response_model=Dict[str, Board])
async def foo(user: str = Depends(lookup_user),
brdmgr: BoardManager = Depends(get_boardmanager)):
brds = brdmgr.boards
@@ -293,19 +293,19 @@ class TestBiteLab(unittest.IsolatedAsyncioTestCase):

async def test_notauth(self):
# test that simple accesses are denied
res = await self.client.get('/board_classes')
res = await self.client.get('/board/classes')
self.assertEqual(res.status_code, HTTP_401_UNAUTHORIZED)

res = await self.client.get('/board_info')
res = await self.client.get('/board/')
self.assertEqual(res.status_code, HTTP_401_UNAUTHORIZED)

# test that invalid api keys are denied
res = await self.client.get('/board_classes',
res = await self.client.get('/board/classes',
auth=BiteAuth('badapikey'))
self.assertEqual(res.status_code, HTTP_401_UNAUTHORIZED)

async def test_classes(self):
res = await self.client.get('/board_classes',
res = await self.client.get('/board/classes',
auth=BiteAuth('thisisanapikey'))
self.assertEqual(res.status_code, HTTP_200_OK)
self.assertEqual(res.json(), { 'cora-z7s': BoardClassInfo(**{
@@ -335,7 +335,7 @@ class TestBiteLab(unittest.IsolatedAsyncioTestCase):
sg.return_value = False

# that getting the board info
res = await self.client.get('/board_info',
res = await self.client.get('/board/',
auth=BiteAuth('thisisanapikey'))

# calls snmpget w/ the correct args


Loading…
Cancel
Save