Example #1
0
 def setUp(self):
     super(TestStoreStateDal, self).setUp()
     self.useFixture(DBConnectionFx())
     self.dbfixture = self.useFixture(DBFixture())
     self.session = self.dbfixture.session
     self.dal = StoreStateDal()
Example #2
0
 def get_store_state_id_by_ch_name(self, ch_name):
     ste = StoreStateDal()
     store_state = ste.get_store_state_id_by_ch_name(ch_name)
     return self.actual_return_id_val(store_state)
Example #3
0
class TestStoreStateDal(TestCase):
    def setUp(self):
        super(TestStoreStateDal, self).setUp()
        self.useFixture(DBConnectionFx())
        self.dbfixture = self.useFixture(DBFixture())
        self.session = self.dbfixture.session
        self.dal = StoreStateDal()

    # unittest of method add_asset_type
    def test_add_asset_type(self):

        self.assertIsNone(self.dal.get_store_state_id_by_ch_name(ch_name=u"存在"))
        self.dal.add_asset_type(store_state=u"存在")
        self.assertEqual(u"存在", self.dal.get_store_state_id_by_ch_name(ch_name=u"存在").ch_name)
        self.dal.del_store_state_by_ch_name(store_state=u"存在")

    # unittest of method get_store_state(the store_state exist)
    def test_get_store_state(self):

        store_state = self.dal.get_store_state(store_state_id="1", store_state_name=u"库存")
        self.assertEqual(u"库存", store_state.ch_name)

    # unittest of method get_store_state(the store_state not exist)
    def test_get_store_state_not_exist(self):
        store_state = self.dal.get_store_state(store_state_id="1", store_state_name=u"库存库存")
        self.assertIsNone(store_state)

    # unittest of method del_store_state_by_ch_name(ch_name exist)
    #
    def test_del_store_state_by_ch_name(self):

        self.dal.add_asset_type(store_state=u"test")
        self.assertTrue(self.dal.del_store_state_by_ch_name(store_state=u"test"))

    # unittest of method del_store_state_by_ch_name(ch_name not exist)
    #
    def test_del_store_state_by_ch_name_not_exist(self):

        # self.dal.add_asset_type(store_state=u'test')
        self.assertTrue(self.dal.del_store_state_by_ch_name(store_state=u"test"))
Example #4
0
 def get_store_state_name_by_num(self, store_state_id):
     ste = StoreStateDal()
     store_state = ste.get_store_state_name_by_id(store_state_id)
     return self.actual_return_ch_name_val(store_state)