|
|
@@ -336,8 +336,10 @@ async def release_board(board_id, user: str = Depends(lookup_user), |
|
|
|
|
|
|
|
return brd |
|
|
|
|
|
|
|
@router.post('/board/{board_id_or_class}/attrs', response_model=Union[Board, Error]) |
|
|
|
async def set_board_attrs(): |
|
|
|
@router.post('/board/{board_id}/attrs', response_model=Union[Board, Error]) |
|
|
|
async def set_board_attrs(board_id, |
|
|
|
attrs: Dict[str, Any], |
|
|
|
brdmgr: BoardManager = Depends(get_boardmanager)): |
|
|
|
pass |
|
|
|
|
|
|
|
@router.get('/board/',response_model=Dict[str, Board]) |
|
|
@@ -392,10 +394,6 @@ class TestUnhashLRU(unittest.TestCase): |
|
|
|
# does not return the same object as the first cache |
|
|
|
self.assertIsNot(cachefun(lsta), cachefun2(lsta)) |
|
|
|
|
|
|
|
async def _setup_data(data): |
|
|
|
await data.APIKey.objects.create(user='foo', key='thisisanapikey') |
|
|
|
await data.APIKey.objects.create(user='bar', key='anotherlongapikey') |
|
|
|
|
|
|
|
# Per RFC 5737 (https://tools.ietf.org/html/rfc5737): |
|
|
|
# The blocks 192.0.2.0/24 (TEST-NET-1), 198.51.100.0/24 (TEST-NET-2), |
|
|
|
# and 203.0.113.0/24 (TEST-NET-3) are provided for use in |
|
|
@@ -421,7 +419,7 @@ class TestBiteLab(unittest.IsolatedAsyncioTestCase): |
|
|
|
self.dbtempfile.name) |
|
|
|
self.data = make_orm(self.database) |
|
|
|
|
|
|
|
await _setup_data(self.data) |
|
|
|
await data._setup_data(self.data) |
|
|
|
|
|
|
|
# setup settings |
|
|
|
self.settings = config.Settings(db_file=self.dbtempfile.name, |
|
|
@@ -635,32 +633,3 @@ class TestBiteLab(unittest.IsolatedAsyncioTestCase): |
|
|
|
'attrs': { 'power': True }, |
|
|
|
} |
|
|
|
self.assertEqual(res.json(), info) |
|
|
|
|
|
|
|
class TestDatabase(unittest.IsolatedAsyncioTestCase): |
|
|
|
def setUp(self): |
|
|
|
# setup temporary directory |
|
|
|
self.dbtempfile = tempfile.NamedTemporaryFile() |
|
|
|
|
|
|
|
self.database = data.databases.Database('sqlite:///' + |
|
|
|
self.dbtempfile.name) |
|
|
|
self.data = make_orm(self.database) |
|
|
|
|
|
|
|
def tearDown(self): |
|
|
|
self.data = None |
|
|
|
self.database = None |
|
|
|
self.dbtempfile = None |
|
|
|
|
|
|
|
async def test_apikey(self): |
|
|
|
data = self.data |
|
|
|
|
|
|
|
# that the test database starts empty |
|
|
|
self.assertEqual(await data.APIKey.objects.all(), []) |
|
|
|
|
|
|
|
# that when it is populated with test data |
|
|
|
await _setup_data(data) |
|
|
|
|
|
|
|
# the data can be accessed |
|
|
|
self.assertEqual((await data.APIKey.objects.get( |
|
|
|
key='thisisanapikey')).user, 'foo') |
|
|
|
self.assertEqual((await data.APIKey.objects.get( |
|
|
|
key='anotherlongapikey')).user, 'bar') |