metaplugins.server_roles module

Set server roles based on a list of roles attached to the test using metadata plugin.

If you want to specify certain roles that have to be set, you can use this type of decoration:

def test_appliance_roles():
    assert foo

This takes the current list from cfme_data.yaml and modifies it by the server_roles keyword. If prefixed with + or nothing, it adds, if prefixed with -, it removes the role. It can be combined either in string and in list, so these lines are functionally equivalent:

"+automate -foo bar" # (add automate and bar, remove foo)
["+automate", "-foo", "bar"]

If you specify the server_roles as None, then all roles are flushed and the list contains only user_interface role.

Roles can be pulled from the cfme_data fixture using yaml selectors, which will do a ‘set’ with the list of roles found at the target path:

@pytest.mark.meta(server_roles=('level1', 'sublevel2'), server_roles_mode='cfmedata')
def test_appliance_roles():
    assert len(get_server_roles()) == 3

Which corresponds to this yaml layout:

        - database_operations
        - user_interface
        - web_services

To ensure the appliance has the default roles:

def test_appliance_roles():

For a list of server role names currently exposed in the CFME interface, see keys of cfme.configure.configuration.server_roles.

metaplugins.server_roles.add_server_roles(server_roles, server_roles_mode='add')[source]