Пример #1
0
 def test_get_url_cache(self):
     entity = memcache.get('1')  # 1st element in DB
     self.assertEqual(None, entity)
     entity = shorten.Shortened(url="http://www.google.com")
     entity.put()
     entity = memcache.get('1')
     self.assertEqual(None, entity)
     url = self.MainPage.get_url('1')
     entity = memcache.get('1')
     self.assertEqual(entity, "http://www.google.com")
Пример #2
0
 def setUp(self):  # Populate test entities.
     entity = shorten.Shortened(url="http://www.google.com")
     self.setup_key = entity.put()
Пример #3
0
 def test_get_by_id_entity(self):
     entity = shorten.Shortened(url="http://www.wikipedia.")
     entity.put()
     key_id = entity.key().id()
     entity_bis = shorten.Shortened.get_by_id(key_id)
     self.assertEqual(entity.url, entity_bis.url)
Пример #4
0
 def test_saved_enitity(self):
     entity = shorten.Shortened(url="http://www.amazon.com")
     key = entity.put()
     self.assertEqual("http://www.amazon.com", db.get(key).url)
Пример #5
0
 def test_new_entity(self):
     entity = shorten.Shortened(url="http://www.amazon.com")
     self.assertEqual("http://www.amazon.com", entity.url)
Пример #6
0
 def test_get_url_return(self):
     entity = shorten.Shortened(url="http://www.google.com")
     entity.put()
     url = self.MainPage.get_url('1')  # 1st element in DB
     self.assertEqual(url, "http://www.google.com")