def testHasProxy():
    """FacadeTest: Test has_proxy()"""
    fcde = Facade('test')
    fcde.register_proxy(Proxy('hasProxyTest', [1,2,3]))
    ok_(fcde.has_proxy('hasProxyTest'))

    fcde.remove_proxy('hasProxyTest')
    ok_(not fcde.has_proxy('hasProxyTest'))
def testRegisterAndRemoveProxy():
    """FacadeTest: Test register_proxy() and remove_proxy()"""
    fcde = Facade('test')
    pxy = Proxy('sizes', ['7', '13', '21'])
    fcde.register_proxy(pxy)

    removedProxy = fcde.remove_proxy('sizes')
    eq_(removedProxy.get_proxy_name(), 'sizes')

    pxy = fcde.retrieve_proxy('sizes')
    ok_(pxy is None)
def test_register_retrieve_and_remove_proxy():
    """FacadeTest: Test register_proxy() and remove_proxy()"""
    facade = Facade("test_register_retrieve_and_remove_proxy")

    facade.register_proxy(CustomProxy())

    proxy = facade.retrieve_proxy("CustomProxy")
    eq_(proxy.get_data(), 5)

    removedProxy = facade.remove_proxy("CustomProxy")
    eq_(removedProxy.get_proxy_name(), "CustomProxy")

    proxy = facade.retrieve_proxy("CustomProxy")
    ok_(proxy is None)
def testRegisterAndRetrieveProxy():
    """FacadeTest: Test register_proxy() and retrieve_proxy()"""
    fcde = Facade('test')
    fcde.register_proxy(Proxy('colors', ['red', 'green', 'blue']))
    pxy = fcde.retrieve_proxy('colors')

    ok_(isinstance(pxy, IProxy))

    data = pxy.get_data()

    ok_(data is not None)
    ok_(isinstance(data, list))
    eq_(len(data), 3)
    eq_(data[0], 'red')
    eq_(data[1], 'green')
    eq_(data[2], 'blue')