示例#1
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)
示例#2
0
    def testRegisterAndRetrieveProxy(self):
        """ModelTest: Test register_proxy() and retrieve_proxy()"""
        model = Model('test')
        model.register_proxy(Proxy('colors', ['red', 'green', 'blue']))
        testProxy = model.retrieve_proxy('colors')
        data = testProxy.get_data()

        self.assertNotEqual(None, data)
        self.assertEqual(True, isinstance(data, list))
        self.assertEqual(True, len(data) == 3 )
        self.assertEqual(True, data[0]  == 'red' )
        self.assertEqual(True, data[1]  == 'green' )
        self.assertEqual(True, data[2]  == 'blue' )