Separate stable API profile IDs from display names with legacy aliases

This commit is contained in:
Mikei386 committed 2026-10-03 23:35:30 +02:00
1 parent 0cffcf4295
commit a908313c8f
7 files changed
+88 -11

No files matched your search

+9
View File
@@ -61,6 +61,15 @@ class EndpointTests(unittest.TestCase):
def request(self,path='/v1/models',data=None,token='A'*32):
conn=http.client.HTTPConnection('127.0.0.1',self.port,timeout=5);headers={'Content-Type':'application/json','Authorization':'Bearer '+token}
conn.request('POST' if data is not None else 'GET',path,body=json.dumps(data) if data is not None else None,headers=headers);r=conn.getresponse();body=r.read();conn.close();return r.status,(body if data and data.get('stream') else json.loads(body))
def test_api_identity_and_legacy_name_share_profile(self):
self.rows[0].update(name='Qwen Medium',api_id='qwen-medium',api_aliases=['Old Name'])
self.enable('alpha')
_,listing=self.request()
self.assertEqual(listing['data'][0]['id'],'qwen-medium')
self.assertEqual(listing['data'][0]['display_name'],'Qwen Medium')
for name in ['qwen-medium','Qwen Medium','Old Name']:
self.assertEqual(self.ep.find_profile(name,'chat')['id'],'alpha')
def test_discovery_reports_profile_context_without_loading(self):
self.rows[0]['parameters'].update(context=160000,slots=2)
self.rows[0]['model']={'repo':'Qwen/Qwen3.8-27B'}