-
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.
Remove nailgun.entities imports in pytest_fixtures (#15084)
(cherry picked from commit 1e952b1)
- Loading branch information
1 parent
1a7c737
commit bf6dac8
Showing
11 changed files
with
81 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
# Compute Profile Fixtures | ||
from nailgun import entities | ||
import pytest | ||
|
||
|
||
@pytest.fixture(scope='module') | ||
def module_compute_profile(): | ||
return entities.ComputeProfile().create() | ||
def module_compute_profile(module_target_sat): | ||
return module_target_sat.api.ComputeProfile().create() |
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
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
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
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
# Subnet Fixtures | ||
from nailgun import entities | ||
import pytest | ||
|
||
|
||
@pytest.fixture(scope='module') | ||
def module_default_subnet(module_org, module_location): | ||
return entities.Subnet(location=[module_location], organization=[module_org]).create() | ||
def module_default_subnet(module_target_sat, module_org, module_location): | ||
return module_target_sat.api.Subnet( | ||
location=[module_location], organization=[module_org] | ||
).create() |
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 |
---|---|---|
@@ -1,12 +1,9 @@ | ||
from nailgun import entities | ||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def user_not_exists(request): | ||
def user_not_exists(request, target_sat): | ||
"""Remove a user if it exists. Return whether changes have been applied.""" | ||
users = entities.User().search(query={'search': f'login={request.param}'}) | ||
if users: | ||
if users := target_sat.api.User().search(query={'search': f'login={request.param}'}): | ||
users[0].delete() | ||
return True | ||
return False | ||
return bool(users) |
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