예제 #1
0
    def test_json_by_ids(self):
        some_branch = Branch.create_if_possible('some-branch', 'Some Branch')
        some_platform = Platform.create_if_possible('some-platform',
                                                    'Some Platform')
        some_builder = Builder.get(
            Builder.create('some-builder', 'Some Builder'))
        some_test = Test.update_or_insert('some-test', some_branch,
                                          some_platform)

        self._create_results(some_branch, some_platform, some_builder,
                             'some-test', [50.0])
        runs = Runs.update_or_insert(some_branch, some_platform, some_test)
        runs_json = runs.to_json()

        key_name = Runs._key_name(some_branch.id, some_platform.id,
                                  some_test.id)
        self.assertEqual(
            Runs.json_by_ids(some_branch.id, some_platform.id, some_test.id),
            runs_json)
        self.assertEqual(memcache.get(key_name), runs_json)

        memcache.set(key_name, 'blah')
        self.assertEqual(
            Runs.json_by_ids(some_branch.id, some_platform.id, some_test.id),
            'blah')

        memcache.delete(key_name)
        self.assertEqual(
            Runs.json_by_ids(some_branch.id, some_platform.id, some_test.id),
            runs_json)
        self.assertEqual(memcache.get(key_name), runs_json)
예제 #2
0
    def get(self):
        self.response.headers['Content-Type'] = 'application/json'

        test_id, branch_id, platform_id = _get_test_branch_platform_ids(self)
        runs = Runs.json_by_ids(branch_id, platform_id, test_id)
        if runs:
            self.response.out.write(runs)
        elif model_from_numeric_id(branch_id, Branch) and model_from_numeric_id(platform_id, Platform) and model_from_numeric_id(test_id, Test):
            schedule_runs_update(test_id, branch_id, platform_id)
예제 #3
0
    def get(self):
        self.response.headers['Content-Type'] = 'application/json'

        test_id, branch_id, platform_id = _get_test_branch_platform_ids(self)
        runs = Runs.json_by_ids(branch_id, platform_id, test_id)
        if runs:
            self.response.out.write(runs)
        elif model_from_numeric_id(branch_id, Branch) and model_from_numeric_id(platform_id, Platform) and model_from_numeric_id(test_id, Test):
            schedule_runs_update(test_id, branch_id, platform_id)
예제 #4
0
    def test_json_by_ids(self):
        some_branch = Branch.create_if_possible('some-branch', 'Some Branch')
        some_platform = Platform.create_if_possible('some-platform', 'Some Platform')
        some_builder = Builder.get(Builder.create('some-builder', 'Some Builder'))
        some_test = Test.update_or_insert('some-test', some_branch, some_platform)

        self._create_results(some_branch, some_platform, some_builder, 'some-test', [50.0])
        runs = Runs.update_or_insert(some_branch, some_platform, some_test)
        runs_json = runs.to_json()

        key_name = Runs._key_name(some_branch.id, some_platform.id, some_test.id)
        self.assertEqual(Runs.json_by_ids(some_branch.id, some_platform.id, some_test.id), runs_json)
        self.assertEqual(memcache.get(key_name), runs_json)

        memcache.set(key_name, 'blah')
        self.assertEqual(Runs.json_by_ids(some_branch.id, some_platform.id, some_test.id), 'blah')

        memcache.delete(key_name)
        self.assertEqual(Runs.json_by_ids(some_branch.id, some_platform.id, some_test.id), runs_json)
        self.assertEqual(memcache.get(key_name), runs_json)