fix: serve the eSIM GET endpoints from _do_GET; release v3.0.0
The three eSIM GET routes were inserted after the POST-only /api/verify-adm branch, i.e. into the _do_POST chain, so GET /api/esim/chip|profiles|notifications fell through to the 404 handler (only POST /api/esim/profile was reachable). - Moved /api/esim/chip|profiles|notifications into _do_GET (after /api/status); /api/esim/profile stays in _do_POST. - Regression test: inspect the handler sources and assert each route is in the right chain. - Version 3.0.0 (eSIM support is a major update): server/pyproject/PWA header, sw.js simple-v227.
This commit is contained in:
@@ -6,6 +6,7 @@ monkeypatched with canned responses, so the mapping to the JSON API and the
|
||||
ISD-R selection/restore logic are tested without hardware.
|
||||
"""
|
||||
|
||||
import inspect
|
||||
import unittest
|
||||
from types import SimpleNamespace
|
||||
|
||||
@@ -192,5 +193,18 @@ class EsimTests(unittest.TestCase):
|
||||
esim.chip_info(app)
|
||||
|
||||
|
||||
class EsimRoutingTests(unittest.TestCase):
|
||||
def test_esim_routes_are_in_the_right_http_handlers(self):
|
||||
from pysim_simple_server import server
|
||||
get_src = inspect.getsource(server.PysimHandler._do_GET)
|
||||
post_src = inspect.getsource(server.PysimHandler._do_POST)
|
||||
for route in ('/api/esim/chip', '/api/esim/profiles',
|
||||
'/api/esim/notifications'):
|
||||
self.assertIn("self.path == '%s'" % route, get_src, route)
|
||||
self.assertNotIn("self.path == '%s'" % route, post_src, route)
|
||||
self.assertIn("self.path == '/api/esim/profile'", post_src)
|
||||
self.assertNotIn("self.path == '/api/esim/profile'", get_src)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user