fix: refresh expired Baidu sessions and fingerprint legacy UI assets
This commit is contained in:
@@ -97,5 +97,13 @@ class ArchiveTests(unittest.TestCase):
|
||||
self.segment()
|
||||
with self.assertRaises(app.Problem):app.ARCHIVE.local(dict(root='current',path='../vision.db'))
|
||||
|
||||
def test_revoked_access_token_refreshes_once(self):
|
||||
saved=dict(config={},connections={'shared':dict(access_token='old',refresh_token='fixture',expires=10**12)})
|
||||
app.BAIDU.write(saved)
|
||||
error=app.Problem('expired');error.reauthorize=True
|
||||
with patch.object(app.BAIDU,'json_request',side_effect=[error,{'ok':True}]) as request, patch.object(app.BAIDU,'token_response',return_value=dict(access_token='new',refresh_token='fixture',expires=10**12)) as refresh:
|
||||
self.assertEqual(app.BAIDU.request('shared','file','list'),{'ok':True})
|
||||
refresh.assert_called_once();self.assertEqual(request.call_count,2)
|
||||
|
||||
|
||||
if __name__=='__main__':unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user