-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ansible, oscap, smartproxy and user component fixtures
- Loading branch information
Jameer Pathan
committed
Oct 8, 2020
1 parent
c001f61
commit 7253937
Showing
7 changed files
with
92 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import pytest | ||
|
||
from robottelo.cli.ansible import Ansible | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def import_ansible_roles(default_smart_proxy): | ||
""" Import ansible roles to default_smart_proxy for tests""" | ||
Ansible.roles_import({'proxy-id': default_smart_proxy.id}) | ||
Ansible.variables_import({'proxy-id': default_smart_proxy.id}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
from robottelo import ssh | ||
from robottelo.helpers import file_downloader | ||
from robottelo.test import settings | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def tailoring_file_path(): | ||
""" Return Tailoring file path.""" | ||
local = file_downloader(file_url=settings.oscap.tailoring_path)[0] | ||
satellite = file_downloader( | ||
file_url=settings.oscap.tailoring_path, hostname=settings.server.hostname | ||
)[0] | ||
return {'local': local, 'satellite': satellite} | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def oscap_content_path(): | ||
""" Download scap content from satellite and return local path of it.""" | ||
_, file_name = os.path.split(settings.oscap.content_path) | ||
local_file = f"/tmp/{file_name}" | ||
ssh.download_file(settings.oscap.content_path, local_file) | ||
return local_file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pytest | ||
from nailgun import entities | ||
|
||
from robottelo.test import settings | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
def default_smart_proxy(): | ||
smart_proxy = ( | ||
entities.SmartProxy() | ||
.search(query={'search': f'name={settings.server.hostname}'})[0] | ||
.read() | ||
) | ||
return entities.SmartProxy(id=smart_proxy.id).read() | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
def import_puppet_classes(): | ||
smart_proxy = ( | ||
entities.SmartProxy() | ||
.search(query={'search': f'name={settings.server.hostname}'})[0] | ||
.read() | ||
) | ||
smart_proxy.import_puppetclasses(environment='production') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pytest | ||
from fauxfactory import gen_string | ||
from nailgun import entities | ||
|
||
from robottelo.constants import DEFAULT_LOC | ||
|
||
|
||
@pytest.fixture(scope='module') | ||
def module_viewer_user(module_org): | ||
"""Custom user with viewer role for tests validating visibility of entities or fields created | ||
by some other user. Created only when accessed, unlike `module_user`. | ||
""" | ||
viewer_role = entities.Role().search(query={'search': 'name="Viewer"'})[0] | ||
default_loc_id = ( | ||
entities.Location().search(query={'search': 'name="{}"'.format(DEFAULT_LOC)})[0].id | ||
) | ||
custom_password = gen_string('alphanumeric') | ||
custom_user = entities.User( | ||
admin=False, | ||
default_organization=module_org, | ||
location=[default_loc_id], | ||
organization=[module_org], | ||
role=[viewer_role], | ||
password=custom_password, | ||
).create() | ||
custom_user.password = custom_password | ||
return custom_user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters