Speed up library loading with shared runtime checks and browser cache
This commit is contained in:
@@ -31,6 +31,16 @@ class Tests(unittest.TestCase):
|
||||
def request(self,path,method='GET',headers=None):
|
||||
req=urllib.request.Request(self.url+'/api/v1/'+path,method=method,headers={"Cookie":self.cookie,**(headers or {})})
|
||||
with urllib.request.urlopen(req) as r:return json.load(r)
|
||||
def test_catalog_checks_runtime_once_without_video_model_scan(self):
|
||||
entries=[dict(id=str(i),repo='test/model',file='model.gguf',kind='chat',size=8) for i in range(12)]
|
||||
with patch.object(self.server.catalog,'status',return_value=dict(entries=entries)), \
|
||||
patch.object(self.server.runtime,'status',return_value={'active':True}) as runtime, \
|
||||
patch.object(self.server.video,'status',side_effect=AssertionError('No video model scan needed')):
|
||||
result=self.request('catalog')
|
||||
self.assertEqual(len(result['entries']),12)
|
||||
self.assertEqual(runtime.call_count,1)
|
||||
self.assertTrue(all('execution' in row and 'used_by_profiles' in row for row in result['entries']))
|
||||
|
||||
def test_demo_removed_from_status(self):
|
||||
state=self.request('status')
|
||||
self.assertNotIn('demo',state)
|
||||
|
||||
Reference in New Issue
Block a user