robottelo.datafactory

Data Factory for all entities

Module Contents

Functions

filtered_datapoint(func)

Overrides the data creator functions in this class to return 1 value and

parametrized(data)

Transforms data dictionary to pytest’s parametrize acceptable format.

generate_strings_list(length=None, exclude_types=None, min_length=3, max_length=30)

Generates a list of different input strings.

add_uppercase_char_into_string(text=None, length=10)

Fix string to include a minimum of one uppercase character.

invalid_emails_list()

Returns a list of invalid emails.

invalid_boolean_strings(list_len=10)

Create a list of invalid booleans. E.g not true nor false

xdist_adapter(argvalues)

Adapter to avoid error when running tests on xdist

invalid_id_list()

Generates a list of invalid IDs.

invalid_names_list()

Generates a list of invalid names.

valid_domain_names(interface=None, length=None)

Valid domain names.

invalid_domain_names(interface=None)

Invalid domain names.

invalid_usernames_list()

invalid_values_list(interface=None)

Generates a list of invalid input values.

valid_data_list(interface=None)

Generates a list of valid input values.

valid_docker_repository_names()

Generates a list of valid names for Docker repository.

valid_emails_list()

Returns a list of valid emails.

valid_environments_list()

Returns a list of valid environment names

invalid_environments_list()

Returns a list of invalid environment names

valid_hosts_list(domain_length=10)

Generates a list of valid host names.

valid_hostgroups_list()

Generates a list of valid host group names.

valid_labels_list()

Generates a list of valid labels.

valid_names_list()

Generates a list of valid names.

valid_org_names_list()

Generates a list of valid organization names.

valid_usernames_list()

Returns a list of valid user names.

valid_interfaces_list()

Generates a list of valid host interface names.

invalid_interfaces_list()

Generates a list of invalid host interface names.

valid_http_credentials(url_encoded=False)

Returns a list of valid credentials for HTTP authentication

invalid_http_credentials(url_encoded=False)

Returns a list of invalid credentials for HTTP authentication

invalid_docker_upstream_names()

Return a list of various kinds of invalid strings for Docker

valid_docker_upstream_names()

Return a list of various kinds of valid strings for Docker repositories.

valid_url_list()

valid_cron_expressions()

Returns a list of valid cron expressions

exception robottelo.datafactory.InvalidArgumentError

Bases: Exception

Indicates an error when an invalid argument is received.

robottelo.datafactory.filtered_datapoint(func)

Overrides the data creator functions in this class to return 1 value and transforms data dictionary to pytest’s parametrize acceptable format for new style generators.

If run_one_datapoint=false, return the entire data set. (default: False) If run_one_datapoint=true, return a random data.

robottelo.datafactory.parametrized(data)

Transforms data dictionary to pytest’s parametrize acceptable format. Generates parametrized test names from data dict keys.

Parameters

data (dict) – dictionary with parametrized test names as dict keys and parametrized arguments as dict values

robottelo.datafactory.generate_strings_list(length=None, exclude_types=None, min_length=3, max_length=30)

Generates a list of different input strings.

Parameters
  • length (int) – Specifies the length of the strings to be be generated. If the len1 is None then the list is returned with string types of random length.

  • exclude_types – Specify a list of data types to be removed from generated list. example: exclude_types=[‘html’, ‘cjk’]

  • min_length (int) – Minimum length to be used in integer generator

  • max_length (int) – Maximum length to be used in integer generator

Returns

A list of various string types.

robottelo.datafactory.add_uppercase_char_into_string(text=None, length=10)

Fix string to include a minimum of one uppercase character. https://github.com/SatelliteQE/robottelo/issues/4742

Parameters
  • text (str) – String to include uppercase character.

  • length (int) – Length of string that we create in case string to change was not provided.

robottelo.datafactory.invalid_emails_list()

Returns a list of invalid emails.

Based on RFC 5321 and 5322, however consecutive dots are removed from the list, as such emails, e.g. email@example..c or dot..dot@example.com are common on the wild and it was decided to treat them as valid.

For more information, see Bugzilla #1455501:.

robottelo.datafactory.invalid_boolean_strings(list_len=10)

Create a list of invalid booleans. E.g not true nor false

Parameters

list_len – len of the list to be generated

Returns

list

robottelo.datafactory.xdist_adapter(argvalues)

Adapter to avoid error when running tests on xdist Check https://github.com/pytest-dev/pytest-xdist/issues/149

It returns a dict with lst as argvalues and range(len(lst)) as ids

Since every run has the same number of values, ids is going to be the same on different workers.

dct = xdist_adapter(invalid_boolean_strings())

@pytest.mark.parametrize('value', **dct)
def test_something(value):
#some code here
Parameters

argvalues – to be passed to parametrize

Returns

dict

robottelo.datafactory.invalid_id_list()

Generates a list of invalid IDs.

robottelo.datafactory.invalid_names_list()

Generates a list of invalid names.

robottelo.datafactory.valid_domain_names(interface=None, length=None)

Valid domain names.

robottelo.datafactory.invalid_domain_names(interface=None)

Invalid domain names.

robottelo.datafactory.invalid_usernames_list()
robottelo.datafactory.invalid_values_list(interface=None)

Generates a list of invalid input values.

This returns invalid values from invalid_names_list() and some interface (api/cli/ui) specific empty string values.

Parameters

interface (str) – Interface name (one of api/cli/ui).

Returns

Returns the invalid values list

Raises

InvalidArgumentError(): If an invalid interface is received.

robottelo.datafactory.valid_data_list(interface=None)

Generates a list of valid input values.

Note: Although this helper is widely used for different attributes for several entities, the following are known behaviors and are handled specifically in the corresponding test modules:

Org - name max length is 242
Loc - name max length is 246
robottelo.datafactory.valid_docker_repository_names()

Generates a list of valid names for Docker repository.

robottelo.datafactory.valid_emails_list()

Returns a list of valid emails.

robottelo.datafactory.valid_environments_list()

Returns a list of valid environment names

robottelo.datafactory.invalid_environments_list()

Returns a list of invalid environment names

robottelo.datafactory.valid_hosts_list(domain_length=10)

Generates a list of valid host names.

Note:: Host name format stored in db is ‘fqdn=’ + host_name + ‘.’ + domain_name Host name max length is: 255 - ‘fqdn=’ - ‘.’ - domain name length (default is 10) = 239 chars (by default). Name should be transformed into lower case

Parameters

domain_length (int) – Domain name length (default is 10).

Returns

Returns the valid host names list

robottelo.datafactory.valid_hostgroups_list()

Generates a list of valid host group names.

Note:: Host group name max length is 245 chars. 220 chars for html as the largest html tag in fauxfactory is 10 chars long, so 245 - (10 chars + 10 chars + ‘<></>’ chars) = 220 chars.

Returns

Returns the valid host group names list

robottelo.datafactory.valid_labels_list()

Generates a list of valid labels.

robottelo.datafactory.valid_names_list()

Generates a list of valid names.

robottelo.datafactory.valid_org_names_list()

Generates a list of valid organization names.

Note:: Organization name max length is 242 chars. 217 chars for html as the largest html tag in fauxfactory is 10 chars long, so 242 - (10 chars + 10 chars + ‘<></>’ chars) = 217 chars.

Returns

Returns the valid organization names list

robottelo.datafactory.valid_usernames_list()

Returns a list of valid user names.

robottelo.datafactory.valid_interfaces_list()

Generates a list of valid host interface names.

robottelo.datafactory.invalid_interfaces_list()

Generates a list of invalid host interface names.

robottelo.datafactory.valid_http_credentials(url_encoded=False)

Returns a list of valid credentials for HTTP authentication The credentials dictionary contains the following keys: login - a username pass - a password quote - a Bool flag stating whether the credentials include special chars http_valid - a Bool flag stating whether the HTTP authentication will pass successfully on the server

Parameters

url_encoded – flag for quoting special characters

Returns

A list of dictionaries with user and password credentials

robottelo.datafactory.invalid_http_credentials(url_encoded=False)

Returns a list of invalid credentials for HTTP authentication

Parameters

url_encoded – flag for quoting special characters

Returns

A list of dictionaries with user and password credentials

robottelo.datafactory.invalid_docker_upstream_names()

Return a list of various kinds of invalid strings for Docker repositories.

robottelo.datafactory.valid_docker_upstream_names()

Return a list of various kinds of valid strings for Docker repositories.

robottelo.datafactory.valid_url_list()
robottelo.datafactory.valid_cron_expressions()

Returns a list of valid cron expressions