mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-07 14:44:22 -07:00
Error Found 3 pep8 issue
This commit is contained in:
parent
9c2dbfc5c1
commit
128bb8b5c0
1 changed files with 8 additions and 4 deletions
|
@ -11,7 +11,9 @@ import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# Add plugins/modules to path for direct import
|
# Add plugins/modules to path for direct import
|
||||||
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../../plugins/modules')))
|
sys.path.insert(0, os.path.abspath(
|
||||||
|
os.path.join(os.path.dirname(__file__), '../../../../plugins/modules')
|
||||||
|
))
|
||||||
|
|
||||||
from nfs_exports_info import get_exports
|
from nfs_exports_info import get_exports
|
||||||
|
|
||||||
|
@ -29,7 +31,8 @@ def test_get_exports_ips_per_share(fake_exports_content):
|
||||||
mock_module = MagicMock()
|
mock_module = MagicMock()
|
||||||
mock_module.digest_from_file.return_value = "fake_sha1_digest"
|
mock_module.digest_from_file.return_value = "fake_sha1_digest"
|
||||||
|
|
||||||
with patch("builtins.open", mock_open(read_data=fake_exports_content)) if sys.version_info[0] == 3 else patch("__builtin__.open", mock_open(read_data=fake_exports_content)):
|
patch_target = "builtins.open" if sys.version_info[0] == 3 else "__builtin__.open"
|
||||||
|
with patch(patch_target, mock_open(read_data=fake_exports_content)):
|
||||||
result = get_exports(mock_module, "ips_per_share")
|
result = get_exports(mock_module, "ips_per_share")
|
||||||
|
|
||||||
expected = {
|
expected = {
|
||||||
|
@ -50,7 +53,8 @@ def test_get_exports_shares_per_ip(fake_exports_content):
|
||||||
mock_module = MagicMock()
|
mock_module = MagicMock()
|
||||||
mock_module.digest_from_file.return_value = "fake_sha1_digest"
|
mock_module.digest_from_file.return_value = "fake_sha1_digest"
|
||||||
|
|
||||||
with patch("builtins.open", mock_open(read_data=fake_exports_content)) if sys.version_info[0] == 3 else patch("__builtin__.open", mock_open(read_data=fake_exports_content)):
|
patch_target = "builtins.open" if sys.version_info[0] == 3 else "__builtin__.open"
|
||||||
|
with patch(patch_target, mock_open(read_data=fake_exports_content)):
|
||||||
result = get_exports(mock_module, "shares_per_ip")
|
result = get_exports(mock_module, "shares_per_ip")
|
||||||
|
|
||||||
expected = {
|
expected = {
|
||||||
|
@ -66,4 +70,4 @@ def test_get_exports_shares_per_ip(fake_exports_content):
|
||||||
}
|
}
|
||||||
|
|
||||||
assert result['exports_info'] == expected
|
assert result['exports_info'] == expected
|
||||||
assert result['file_digest'] == "fake_sha1_digest"
|
assert result['file_digest'] == "fake_sha1_digest"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue