示例#1
0
def test_update_virtual_address():
    va = VirtualAddress(**va_cfg)

    assert 'address' in va.data

    # Verify that immutable 'address' is not passed to parent method
    with patch.object(Resource, 'update') as mock_method:
        va.update(bigip)
        assert 1 == mock_method.call_count
        assert 'address' not in mock_method.call_args[1]['data']
示例#2
0
def test_update_virtual_address():
    va = VirtualAddress(**va_cfg)

    assert 'address' in va.data
    assert 'metadata' in va.data

    # Verify that immutable 'address' is not passed to parent method
    with patch.object(Resource, 'update') as mock_method:
        va.update(bigip)
        assert 1 == mock_method.call_count
        assert 'address' not in mock_method.call_args[1]['data']
示例#3
0
def test_equals_virtual_address():
    va1 = VirtualAddress(**va_cfg)
    va2 = VirtualAddress(**va_cfg)
    va3 = deepcopy(va1)

    assert id(va1) != id(va2)
    assert va1 == va2

    assert id(va1) != id(va3)
    assert va1 == va3

    va3._data['address'] = "192.168.200.100"
    assert va1 != va3

    assert va1 != va_cfg
示例#4
0
def test_create_virtual_address_defaults():
    va = VirtualAddress(name="test_va", partition="Test")

    assert va

    assert va.name == "test_va"
    assert va.partition == "Test"

    data = va.data
    assert not data['address']
    assert data['autoDelete'] == "false"
    assert not data['enabled']
    assert not data['description']
    assert data['trafficGroup'] == "/Common/traffic-group-1"
示例#5
0
def test_create_virtual_address():
    va = VirtualAddress(**va_cfg)

    assert va

    assert va.name == "192.168.100.100"
    assert va.partition == "Test"

    data = va.data
    assert data['address'] == "192.168.100.100"
    assert data['autoDelete'] == "true"
    assert data['enabled'] == "yes"
    assert data['description'] == "Test virutal address resource"
    assert data['trafficGroup'] == "/Common/traffic-group-local-only"
示例#6
0
def test_get_uri_path(bigip):
    va = VirtualAddress(**va_cfg)

    assert (
        va._uri_path(bigip) == bigip.tm.ltm.virtual_address_s.virtual_address)
示例#7
0
def test_get_uri_path(bigip):
    va = VirtualAddress(**va_cfg)

    assert (va._uri_path(bigip) ==
            bigip.tm.ltm.virtual_address_s.virtual_address)