Exemple #1
0
    def test_read_on_identity_ref(self):
        r_1 = ysanity.Runner.Ytypes.BuiltInT()
        r_1.identity_ref_value = ysanity.ChildIdentity()
        self.crud.create(self.ncc, r_1)

        r_2 = ysanity.Runner()
        r_2.ytypes.built_in_t.identity_ref_value.yfilter = YFilter.read
        runner_read = self.crud.read(self.ncc, r_2)
        self.assertEqual(r_1.identity_ref_value, runner_read.ytypes.built_in_t.identity_ref_value)
    def test_read_on_identity_ref(self):
        r_1 = ysanity.Runner.Ytypes.BuiltInT()
        r_1.identity_ref_value = ysanity.ChildIdentity()
        self.crud.create(self.ncc, r_1)

        r_2 = ysanity.Runner().Ytypes.BuiltInT()
        r_2.identity_ref_value = YFilter.read
        t_read = self.crud.read(self.ncc, r_2)
        self.assertIsNotNone(t_read)
        self.assertEqual(r_1.identity_ref_value, t_read.identity_ref_value)
    def test_identityref(self):
        runner = ysanity.Runner()
        runner.ytypes.built_in_t.identity_ref_value = \
            ysanity.ChildIdentity()
        self.crud.create(self.ncc, runner)

        # Read into Runner1
        runner1 = ysanity.Runner()
        runner1 = self.crud.read(self.ncc, runner1)

        # Compare runners
        self.assertEqual(runner, runner1)
    def test_delete_on_list_with_identitykey(self):
        runner = ysanity.Runner()
        a1 = ysanity.Runner.OneList.IdentityList()
        a1.config.id = ysanity.ChildIdentity()
        a1.id_ref = a1.config.id.to_string()
        runner.one_list.identity_list.append(a1)
        self.crud.create(self.ncc, runner)

        empty_runner = ysanity.Runner()

        runner_update = ysanity.Runner()
        k = ysanity.Runner.OneList.IdentityList()
        k.config.id = ysanity.ChildIdentity()
        k.id_ref = k.config.id.to_string()
        k.yfilter = YFilter.delete
        runner_update.one_list.identity_list.append(k)

        self.crud.update(self.ncc, runner_update)

        runner_read = self.crud.read(self.ncc, empty_runner)

        self.assertEqual(runner_read, None)
    def test_identity_leaflist(self):
        runner = ysanity.Runner()
        runner.ytypes.built_in_t.identity_llist.append(ysanity.ChildIdentity())
        runner.ytypes.built_in_t.identity_llist.append(
            ysanity.ChildChildIdentity())
        self.crud.create(self.ncc, runner)

        # Read into Runner1
        runner1 = ysanity.Runner()
        runner1 = self.crud.read(self.ncc, runner1)

        # Compare runners
        self.assertEqual(runner, runner1)