Example #1
0
    def test_model_from_numeric_id(self):

        def execute(id):
            return Branch(id=id, name='some branch', key_name='some-branch').put()

        branch = Branch.get(create_in_transaction_with_numeric_id_holder(execute))

        self.assertEqual(model_from_numeric_id(branch.id, Branch).key(), branch.key())
        self.assertEqual(model_from_numeric_id(branch.id + 1, Branch), None)
        delete_model_with_numeric_id_holder(branch)
        self.assertEqual(model_from_numeric_id(branch.id, Branch), None)
Example #2
0
    def test_model_from_numeric_id(self):

        def execute(id):
            return Branch(id=id, name='some branch', key_name='some-branch').put()

        branch = Branch.get(create_in_transaction_with_numeric_id_holder(execute))

        self.assertEqual(model_from_numeric_id(branch.id, Branch).key(), branch.key())
        self.assertEqual(model_from_numeric_id(branch.id + 1, Branch), None)
        delete_model_with_numeric_id_holder(branch)
        self.assertEqual(model_from_numeric_id(branch.id, Branch), None)
Example #3
0
    def test_delete_model_with_numeric_id_holder(self):

        def execute(id):
            return Branch(id=id, name='some branch', key_name='some-branch').put()

        branch = Branch.get(create_in_transaction_with_numeric_id_holder(execute))
        self.assertOnlyInstance(branch)

        delete_model_with_numeric_id_holder(branch)

        self.assertThereIsNoInstanceOf(Branch)
        self.assertThereIsNoInstanceOf(NumericIdHolder)
Example #4
0
    def test_delete_model_with_numeric_id_holder(self):

        def execute(id):
            return Branch(id=id, name='some branch', key_name='some-branch').put()

        branch = Branch.get(create_in_transaction_with_numeric_id_holder(execute))
        self.assertOnlyInstance(branch)

        delete_model_with_numeric_id_holder(branch)

        self.assertThereIsNoInstanceOf(Branch)
        self.assertThereIsNoInstanceOf(NumericIdHolder)
Example #5
0
    def test_delete_model_with_numeric_id_holder(self):

        def execute(id):
            return models.Branch(id=id, name='some branch', key_name='some-branch').put()

        branch = models.Branch.get(models.create_in_transaction_with_numeric_id_holder(execute))
        self.assertEqual(len(models.NumericIdHolder.all().fetch(5)), 1)

        models.delete_model_with_numeric_id_holder(branch)

        self.assertEqual(len(models.Branch.all().fetch(5)), 0)
        self.assertEqual(len(models.NumericIdHolder.all().fetch(5)), 0)
Example #6
0
    def post(self):
        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8';

        merge = Test.get_by_key_name(self.request.get('merge'))
        into = Test.get_by_key_name(self.request.get('into'))
        if not merge or not into:
            self.response.out.write('Invalid test names')
            return

        merged_results = TestResult.all()
        merged_results.filter('name =', merge.name)
        for result in merged_results:
            result.name = into.name
            result.put()

        # Just flush everyting since we rarely merge tests and we need to flush
        # dashboard, manifest, and all runs for this test here.
        memcache.flush_all()

        delete_model_with_numeric_id_holder(merge)

        self.response.out.write('OK')