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")
def setUp(self): # Populate test entities. entity = shorten.Shortened(url="http://www.google.com") self.setup_key = entity.put()
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)
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)
def test_new_entity(self): entity = shorten.Shortened(url="http://www.amazon.com") self.assertEqual("http://www.amazon.com", entity.url)
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")