예제 #1
0
    def testHasProxy(self):
        """ModelTest: Test has_proxy()"""

        model = Model('test')
        testProxy = Proxy('aces', ['clubs', 'spades', 'hearts', 'diamonds'])
        model.register_proxy(testProxy)

        self.assertEqual(True, model.has_proxy('aces'))

        model.remove_proxy('aces')

        self.assertEqual(False, model.has_proxy('aces'))
예제 #2
0
    def testOnRegisterAndOnRemove(self):
        """ModelTest: Test on_register() and on_remove()"""

        model = Model('test')

        testProxy = utils.model.ModelTestProxy()
        model.register_proxy(testProxy)

        self.assertEqual(True, testProxy.get_data() == utils.model.ModelTestProxy.ON_REGISTER_CALLED)

        model.remove_proxy(utils.model.ModelTestProxy.NAME)

        self.assertEqual(True, testProxy.get_data() == utils.model.ModelTestProxy.ON_REMOVE_CALLED)
예제 #3
0
    def testRegisterAndRemoveProxy(self):
        """ModelTest: Test register_proxy() and remove_proxy()"""
        model = Model('test')
        testProxy = Proxy('sizes', ['7', '13', '21'])
        model.register_proxy(testProxy)

        removedProxy = model.remove_proxy('sizes')

        self.assertEqual(True,removedProxy.get_proxy_name() == 'sizes')

        testProxy = model.retrieve_proxy('sizes')

        self.assertEqual(None, testProxy)