feat: add typed data and views with scoped device power
This commit is contained in:
@@ -224,6 +224,23 @@ class JournalTests(unittest.TestCase):
|
||||
self.assertTrue(app.BAIDU.status(self.actor)['connected'])
|
||||
self.assertNotIn('test-token',json.dumps(app.BAIDU.status(self.actor)))
|
||||
|
||||
def test_callback_domain_migration_retains_tokens_but_invalidates_old_oauth(self):
|
||||
app.BAIDU.configure(self.config(),self.root)
|
||||
app.BAIDU.begin(self.root,'media',self.tokens[self.root['id']],'example.org')
|
||||
saved=app.BAIDU.read()
|
||||
saved['connections']['shared']={'refresh_token':'fixture-refresh','access_token':'fixture-access'}
|
||||
app.BAIDU.write(saved)
|
||||
updated=app.BAIDU.configure(dict(self.config(),secretKey='',revision=1,redirectUri='https://home.example.org/api/baidu/callback'),self.root)
|
||||
self.assertEqual(updated['revision'],2)
|
||||
self.assertEqual(app.BAIDU.read()['connections'],saved['connections'])
|
||||
self.assertEqual(app.BAIDU.pending,{})
|
||||
with self.assertRaises(app.Problem):app.BAIDU.begin(self.root,'media',self.tokens[self.root['id']],'example.org')
|
||||
result,_=app.BAIDU.begin(self.root,'media',self.tokens[self.root['id']],'home.example.org')
|
||||
self.assertIn('home.example.org',result['url'])
|
||||
for change in ({'appKey':'anotherApp'},{'secretKey':'anotherSecret'},{'appFolder':'另一应用'}):
|
||||
with self.subTest(change=change),self.assertRaises(app.Problem):
|
||||
app.BAIDU.configure(dict(self.config(),revision=2,**change),self.root)
|
||||
|
||||
def test_logged_out_or_demoted_oauth_cannot_bind_account(self):
|
||||
app.BAIDU.configure(self.config(),self.root)
|
||||
_,cookie=app.BAIDU.begin(self.root,'media',self.tokens[self.root['id']],'example.org')
|
||||
|
||||
Reference in New Issue
Block a user