示例#1
0
 def test_from_dict_ok(self):
     timestamp = datetime.datetime.utcnow()
     ts = TokenStore.from_dict({
         _ACCESS_TOKEN: 'a',
         _REFRESH_TOKEN: 'b',
         _KEY_TIMESTAMP: timestamp
     })
     self.assertEqual('a', ts.access_token)
     self.assertEqual('b', ts.refresh_token)
     self.assertEqual(timestamp, ts._timestamp)
示例#2
0
 def test_from_dict_invalid(self):
     ts = TokenStore.from_dict({'invalid_key': 'value'})
     self.assertIsNone(ts.access_token)
     self.assertIsNone(ts.refresh_token)
示例#3
0
 def test_from_dict_empty(self):
     ts = TokenStore.from_dict({})
     self.assertIsNone(ts.access_token)
     self.assertIsNone(ts.refresh_token)
示例#4
0
 def test_from_dict_None(self):
     with self.assertRaises(ValueError):
         TokenStore.from_dict(None)
示例#5
0
 def test_from_dict_ok(self):
     ts = TokenStore.from_dict({'access_token': 'a', 'refresh_token': 'b'})
     self.assertEqual('a', ts.access_token)
     self.assertEqual('b', ts.refresh_token)