mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-06 07:00:37 +02:00
Report APKs refused before install; offer a compatibility test after installing an alternative
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
c3ceea9bcd
commit
73eef14ecd
3 files changed
+29
No files matched your search
@@ -256,5 +256,28 @@ class UploadVersionsTest(unittest.TestCase):
|
||||
ssh.assert_not_called()
|
||||
|
||||
|
||||
def test_blocked_uploads_are_reported_like_failed_installs(self):
|
||||
import server
|
||||
info = {'package': 'org.example.app', 'label': 'Example', 'version': '5',
|
||||
'version_code': 5, 'min_sdk': 33, 'abis': [], 'icon_png': None}
|
||||
for apk_info, expected_info in ((dict(info), 'org.example.app'),
|
||||
(frame_android.FrameError('not an APK'), None)):
|
||||
handler = object.__new__(server.Handler)
|
||||
handler.headers = {'X-Filename': 'app.apk', 'X-Mode': 'apk', 'Content-Length': '1'}
|
||||
handler.rfile = io.BytesIO(b'x')
|
||||
calls = []
|
||||
patch_info = (patch.object(frame_android, 'apk_info', side_effect=apk_info)
|
||||
if isinstance(apk_info, Exception) else
|
||||
patch.object(frame_android, 'apk_info', return_value=apk_info))
|
||||
with patch_info, patch.object(frame_android, 'install_hooks', [lambda *a: calls.append(a)]), \
|
||||
patch.object(server, 'ensure_master'):
|
||||
with self.assertRaises(server.Failure):
|
||||
handler.upload()
|
||||
self.assertEqual(len(calls), 1)
|
||||
got_info, meta, error, _ = calls[0]
|
||||
self.assertEqual((got_info or {}).get('package'), expected_info)
|
||||
self.assertIsNone(meta)
|
||||
self.assertIsInstance(error, frame_android.FrameError)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user