コード例 #1
0
    def test_db_mapping_branch(self):
        from emc.kb.mapping_db import Branch
        from emc.kb.mapping_db import Model
        from z3c.saconfig import Session

        import pdb
        pdb.set_trace()
        model = Model()
        model.xhdm = u"C9"
        model.xhmc = u"我的手机"
        Session.add(model)

        branch = Branch()
        branch.fxtdm = u"C91"
        branch.fxtmc = u"发射器"
        branch.fxtlb = u"fashe"

        branch.model = model
        Session.add(branch)
        Session.flush()

        self.assertTrue(branch.branchId is not None)
        self.assertTrue(model.modelId is not None)
        self.assertEqual(branch.modelId, model.modelId)
        self.assertEqual(branch.branchId, model.branches[0].branchId)
コード例 #2
0
    def test_db_mapping_model(self):
        from emc.kb.mapping_db import Model
        from z3c.saconfig import Session

        model = Model()
        model.xhdm = u"C9"
        model.xhmc = u"我的手机"
        Session.add(model)
        Session.flush()
        self.assertTrue(model.modelId is not None)
コード例 #3
0
    def test_db_mapping_model(self):
        from emc.kb.mapping_db import Model
        from z3c.saconfig import Session

        model = Model()
        model.xhdm = u"C9"
        model.xhmc = u"我的手机"
        Session.add(model)
        Session.flush()
        nums = Session.query(func.count(model.modelId)).scalar()
        self.assertTrue(model.modelId is not None)
        print model.xhdm
        print nums
コード例 #4
0
    def test_oracledb_model(self):
        from emc.kb.mapping_db import Model
        from emc.kb import pas_session as Session

        model = Model()
        import pdb
        pdb.set_trace()
        nums = Session.query(func.count(model.modelId)).scalar()
        if nums != 1:

            model.modelId = 100
            model.xhdm = u"C9"
            model.xhmc = u"my phone"
            Session.add(model)
            Session.commit()
            self.assertTrue(model.modelId is not None)

        self.assertTrue(nums is not None)