Beispiel #1
0
def test_uri_path(bigip):
    """Test Profile URI."""
    profile = Profile(**cfg_test)
    assert profile

    with pytest.raises(NotImplementedError):
        profile._uri_path(bigip)
Beispiel #2
0
def test_uri_path(bigip):
    """Test Profile URI."""
    profile = Profile(
        **cfg_test
    )
    assert profile

    with pytest.raises(NotImplementedError):
        profile._uri_path(bigip)
Beispiel #3
0
def test_create_profile():
    """Test Profile creation."""
    profile = Profile(**cfg_test)
    assert profile

    # verify all cfg items
    for k, v in list(cfg_test.items()):
        assert profile.data[k] == v
Beispiel #4
0
def test_eq():
    """Test Profile equality."""
    partition = 'Common'
    name = 'tcp'

    profile1 = Profile(**cfg_test)
    profile2 = Profile(**cfg_test)
    assert profile1
    assert profile2
    assert id(profile1) != id(profile2)
    assert profile1 == profile2

    # not equal
    profile2.data['context'] = 'serverside'
    assert profile1 != profile2

    # different objects
    assert profile1 != "profile1"
Beispiel #5
0
    def _flatten_profiles(self, **properties):
        profiles = list()
        profiles_reference = properties.pop('profilesReference', dict())

        items = profiles_reference.get('items', list())
        for item in items:
            profiles.append(Profile(**item).data)

        return profiles
Beispiel #6
0
def test_eq():
    """Test Profile equality."""
    partition = 'Common'
    name = 'tcp'

    profile1 = Profile(
        **cfg_test
    )
    profile2 = Profile(
        **cfg_test
    )
    assert profile1
    assert profile2
    assert id(profile1) != id(profile2)
    assert profile1 == profile2

    # not equal
    profile2.data['context'] = 'serverside'
    assert profile1 != profile2

    # different objects
    assert profile1 != "profile1"
Beispiel #7
0
    def _flatten_profiles(self, **properties):
        profiles = list()
        profiles_reference = properties.pop('profilesReference', dict())

        items = profiles_reference.get('items', list())
        for item in items:
            try:
                profiles.append(Profile(**item).data)
            except ValueError as error:
                LOGGER.error(
                    "Virtual Create Error: failed to create profile: %s",
                    error)

        return profiles
Beispiel #8
0
def test_repr():
    """Test get repr."""
    profile = Profile(**cfg_test)
    assert profile

    assert (repr(profile) == "Profile('tcp', 'Common', context='all')")