浏览代码

fixed test

Rodja Trappe 1 年之前
父节点
当前提交
b74ca0b8d8
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      tests/test_storage.py

+ 4 - 4
tests/test_storage.py

@@ -80,16 +80,16 @@ def test_user_storage_modifications(screen: Screen):
 async def test_access_user_storage_from_fastapi(screen: Screen):
 async def test_access_user_storage_from_fastapi(screen: Screen):
     @app.get('/api')
     @app.get('/api')
     def api():
     def api():
-        return {'id': app.storage.user['id']}
+        app.storage.user['msg'] = 'yes'
+        return 'OK'
 
 
     screen.ui_run_kwargs['storage_secret'] = 'just a test'
     screen.ui_run_kwargs['storage_secret'] = 'just a test'
     screen.open('/')
     screen.open('/')
     async with httpx.AsyncClient() as http_client:
     async with httpx.AsyncClient() as http_client:
         response = await http_client.get(f'http://localhost:{PORT}/api')
         response = await http_client.get(f'http://localhost:{PORT}/api')
         assert response.status_code == 200
         assert response.status_code == 200
-        session_id = response.json()['id']
-        storage_file = next(Path('.nicegui').glob('storage_user_*.json'))
-        assert session_id in str(storage_file)
+        assert response.text == '"OK"'
+        assert next(Path('.nicegui').glob('storage_user_*.json')).read_text() == '{"msg": "yes"}'
 
 
 
 
 def test_access_user_storage_on_interaction(screen: Screen):
 def test_access_user_storage_on_interaction(screen: Screen):