Esempio n. 1
0
    def post(self):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
        test_id, branch_id, platform_id = _get_test_branch_platform_ids(self)

        branch = model_from_numeric_id(branch_id, Branch)
        platform = model_from_numeric_id(platform_id, Platform)
        test = model_from_numeric_id(test_id, Test)
        display_days = int(self.request.get('displayDays'))
        assert branch
        assert platform
        assert test

        params = Runs(branch, platform, test.name).chart_params(display_days)
        dashboard_chart_file = urllib.urlopen('http://chart.googleapis.com/chart', urllib.urlencode(params))

        DashboardImage.create(branch.id, platform.id, test.id, display_days, dashboard_chart_file.read())
Esempio n. 2
0
    def post(self):
        return
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
        test_id, branch_id, platform_id = _get_test_branch_platform_ids(self)

        branch = model_from_numeric_id(branch_id, Branch)
        platform = model_from_numeric_id(platform_id, Platform)
        test = model_from_numeric_id(test_id, Test)
        display_days = int(self.request.get('displayDays'))
        assert branch
        assert platform
        assert test
        params = Runs.get_by_objects(branch, platform, test).chart_params(display_days)
        if not params:
            return
        dashboard_chart_file = urllib.urlopen('http://chart.googleapis.com/chart', urllib.urlencode(params))

        DashboardImage.create(branch.id, platform.id, test.id, display_days, dashboard_chart_file.read())
Esempio n. 3
0
    def post(self):
        self.response.headers["Content-Type"] = "text/plain; charset=utf-8"
        test_id, branch_id, platform_id = _get_test_branch_platform_ids(self)

        branch = model_from_numeric_id(branch_id, Branch)
        platform = model_from_numeric_id(platform_id, Platform)
        test = model_from_numeric_id(test_id, Test)
        display_days = int(self.request.get("displayDays"))
        assert branch
        assert platform
        assert test

        params = Runs.update_or_insert(branch, platform, test).chart_params(display_days)
        if not params:
            return
        dashboard_chart_file = urllib.urlopen("http://chart.googleapis.com/chart", urllib.urlencode(params))

        DashboardImage.create(branch.id, platform.id, test.id, display_days, dashboard_chart_file.read())
Esempio n. 4
0
    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')
Esempio n. 5
0
    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')
Esempio n. 6
0
 def test_create(self):
     self.assertEqual(memcache.get('dashboard-image:1:2:3:7'), None)
     self.assertThereIsNoInstanceOf(DashboardImage)
     image = DashboardImage.create(1, 2, 3, 7, 'blah')
     self.assertOnlyInstance(image)
     self.assertEqual(memcache.get('dashboard-image:1:2:3:7'), 'blah')
Esempio n. 7
0
 def test_create(self):
     self.assertEqual(memcache.get('dashboard-image:1:2:3:7'), None)
     self.assertThereIsNoInstanceOf(DashboardImage)
     image = DashboardImage.create(1, 2, 3, 7, 'blah')
     self.assertOnlyInstance(image)
     self.assertEqual(memcache.get('dashboard-image:1:2:3:7'), 'blah')