def test_get(self): image = DashboardImage.create(1, 2, 3, 7, 'blah') self.assertEqual(memcache.get('dashboard-image:1:2:3:7'), 'blah') memcache.set('dashboard-image:1:2:3:7', 'new value') # Check twice to make sure the first call doesn't clear memcache self.assertEqual(DashboardImage.get_image(1, 2, 3, 7), 'new value') self.assertEqual(DashboardImage.get_image(1, 2, 3, 7), 'new value') memcache.delete('dashboard-image:1:2:3:7') self.assertEqual(memcache.get('dashboard-image:1:2:3:7'), None) self.assertEqual(DashboardImage.get_image(1, 2, 3, 7), 'blah') self.assertEqual(memcache.get('dashboard-image:1:2:3:7'), 'blah')
def test_get(self): image = DashboardImage.create(1, 2, 3, 7, 'blah') self.assertEqual(memcache.get('dashboard-image:1:2:3:7'), 'blah') memcache.set('dashboard-image:1:2:3:7', 'new value') # Check twice to make sure the first call doesn't clear memcache self.assertEqual(DashboardImage.get_image(1, 2, 3, 7), 'new value') self.assertEqual(DashboardImage.get_image(1, 2, 3, 7), 'new value') memcache.delete('dashboard-image:1:2:3:7') self.assertEqual(memcache.get('dashboard-image:1:2:3:7'), None) self.assertEqual(DashboardImage.get_image(1, 2, 3, 7), 'blah') self.assertEqual(memcache.get('dashboard-image:1:2:3:7'), 'blah')
def get(self, test_id, branch_id, platform_id, display_days): try: branch_id = int(branch_id) platform_id = int(platform_id) test_id = int(test_id) display_days = int(display_days) except ValueError: self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' self.response.out.write('Failed') self.response.headers['Content-Type'] = 'image/png' self.response.out.write(DashboardImage.get_image(branch_id, platform_id, test_id, display_days))
def get(self, test_id, branch_id, platform_id, display_days): try: branch_id = int(branch_id) platform_id = int(platform_id) test_id = int(test_id) display_days = int(display_days) except ValueError: self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' self.response.out.write('Failed') self.response.headers['Content-Type'] = 'image/png' self.response.out.write(DashboardImage.get_image(branch_id, platform_id, test_id, display_days))