test_appengine.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:REMAP 作者: REMAPApp 项目源码 文件源码
def test_get_and_put_set_store_on_cache_retrieval(self):
        storage = appengine.StorageByKeyName(
            appengine.CredentialsModel, 'foo', 'credentials', cache=memcache)

        self.assertEqual(None, storage.get())
        self.credentials.set_store(storage)
        storage.put(self.credentials)
        # Pre-bug 292 old_creds wouldn't have storage, and the _refresh
        # wouldn't be able to store the updated cred back into the storage.
        old_creds = storage.get()
        self.assertEqual(old_creds.access_token, 'foo')
        old_creds.invalid = True
        http = http_mock.HttpMock(data=BASIC_RESP)
        old_creds._refresh(http)
        new_creds = storage.get()
        self.assertEqual(new_creds.access_token, BASIC_TOKEN)

        # Verify mock.
        self._verify_basic_refresh(http)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号