示例#1
0
def test_circuits_update_interface(runner, circuit, interface):
    """ Test updating a circuit's Z side interface """

    with runner.isolated_filesystem():
        result = runner.run('circuits update -i {0} -Z {1}'.format(
            circuit['name'], interface['id']))
        assert_output(result, ['Updated circuit!'])
示例#2
0
def test_circuits_list(runner, circuit):
    """ Make sure we can list out a circuit """

    circuit_name = 'test_circuit'

    with runner.isolated_filesystem():
        result = runner.run('circuits list')
        assert_output(result, [circuit_name])

        result = runner.run('circuits list -i {}'.format(circuit_name))
        assert_output(result, [circuit_name])
示例#3
0
def test_circuits_add_single_sided(runner, interface_a):
    """ Add a circuit with no remote end """

    with runner.isolated_filesystem():
        result = runner.run('circuits add -A {0} -n add_test2'.format(
            interface_a['id']))

        assert_output(result, ['Added circuit!'])

        result = runner.run('circuits list')
        assert_output(result, ['add_test2'])
示例#4
0
def test_circuits_add(runner, interface_a, interface_z):
    """ Test adding a normal circuit """

    with runner.isolated_filesystem():
        # Add a circuit with interfaces on each end
        result = runner.run('circuits add -A {0} -Z {1} -n add_test1'.format(
            interface_a['id'], interface_z['id']))
        assert_output(result, ['Added circuit!'])

        # Verify the circuit was created by listing
        result = runner.run('circuits list')
        assert_output(result, ['add_test1'])
示例#5
0
def test_circuits_update_name(runner, circuit):
    """ Test update by changing the circuit name """

    old_name = 'test_circuit'
    new_name = 'awesome_circuit'

    with runner.isolated_filesystem():
        result = runner.run('circuits update -i {} -n {}'.format(
            old_name, new_name))
        assert result.exit_code == 0

        # Make sure we can look up the circuit by its new name
        result = runner.run('circuits list -i {}'.format(new_name))
        assert_output(result, [new_name])

        # Make sure the old name doesn't exist
        result = runner.run('circuits list -i {}')
        assert result.exit_code != 0
        assert 'No such Circuit found' in result.output