def test_generate_driver(temp_files):
    testconfname, testconfname_bak, testdriverdirname = temp_files
    environment_library.generate_driver(FAKE_ENV)
    assert open(testconfname, 'r').read() == GENDRDATA
    FAKEDMODULE = ENVMODULETEMPLATE.format(FAKE_ENV)
    FAKEMODULENAME = os.path.join(testdriverdirname, 'v2_' + FAKE_ENV + '.py')
    assert open(FAKEMODULENAME, 'r').read() == FAKEDMODULE
示例#2
0
def test_generate_driver(temp_files):
    testconfname, testconfname_bak, testdriverdirname = temp_files
    environment_library.generate_driver(FAKE_ENV)
    assert open(testconfname, 'r').read() == GENDRDATA
    FAKEDMODULE = ENVMODULETEMPLATE.format(FAKE_ENV)
    FAKEMODULENAME = os.path.join(testdriverdirname, 'v2_' + FAKE_ENV + '.py')
    assert open(FAKEMODULENAME, 'r').read() == FAKEDMODULE
def test_generate_driver_module_collision(temp_files):
    testconfname, testconfname_bak, testdriverdirname = temp_files
    FAKEMODULENAME = os.path.join(testdriverdirname, 'v2_' + FAKE_ENV + '.py')
    open(FAKEMODULENAME, 'w').write('COLLISION!')
    with pytest.raises(OSError) as OSEIO:
        environment_library.generate_driver(FAKE_ENV)
    error_message = '"' + os.path.abspath(FAKEMODULENAME) + '"' +\
                    ': Python module already exists!'
    assert OSEIO.value.args[0] == error_message
示例#4
0
def test_generate_driver_module_collision(temp_files):
    testconfname, testconfname_bak, testdriverdirname = temp_files
    FAKEMODULENAME = os.path.join(testdriverdirname, 'v2_' + FAKE_ENV + '.py')
    open(FAKEMODULENAME, 'w').write('COLLISION!')
    with pytest.raises(OSError) as OSEIO:
        environment_library.generate_driver(FAKE_ENV)
    error_message = '"' + os.path.abspath(FAKEMODULENAME) + '"' +\
                    ': Python module already exists!'
    assert OSEIO.value.args[0] == error_message
def main():
    parser = argparse.ArgumentParser(
        description='''This utility is designed to run on the Neutron
        controller. Use the
        ``f5lbaasdriver.utils.add_environment.add_diff_env_to_controller``
        function to remotely configure your controller with this utility.

        ''')
    parser.add_argument("environment",
                        help="The name of the environment to generate.")
    args = parser.parse_args()
    generate_driver(args.environment)
def main():
    parser = argparse.ArgumentParser(
        description='''This utility is designed to run on the Neutron
        controller. Use the
        ``f5lbaasdriver.utils.add_environment.add_diff_env_to_controller``
        function to remotely configure your controller with this utility.

        ''')
    parser.add_argument("environment",
                        help="The name of the environment to generate.")
    args = parser.parse_args()
    generate_driver(args.environment)