def test_fd_load_order(hallo_getter):
    hallo, test_server, test_channel, test_user = hallo_getter({})
    # Create a blank function dispatcher
    fd = FunctionDispatcher(set(), hallo)
    try:
        # Add modules to allowed list
        fd.module_list = {"euler", "math"}
        # Load up Euler module, ensure no other modules load.
        assert fd.reload_module("euler")
        assert len(fd.function_dict) == 1
        # Load second module, ensure all methods are there.
        assert fd.reload_module("math")
        assert len(fd.function_dict) == 2
    finally:
        fd.close()
def test_fd_disallowed_module(hallo_getter):
    hallo, test_server, test_channel, test_user = hallo_getter({})
    # Create a blank function dispatcher
    fd = FunctionDispatcher(set(), hallo)
    try:
        # Try and load a module
        assert not fd.reload_module("euler")
    finally:
        fd.close()