mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-17 06:29:12 -07:00
Rename AWS unit tests that are not running when changing the module (#42712)
now can use `ansible-test units module_name` for the aws_s3 and aws_api_gateway modules changes to modules/cloud/amazon/aws_api_gateway and modules/cloud/amazon/aws_s3 are not triggering the unit tests; also fix aws_s3 from importing non-exist module and skipping tests changes to module_utils/aws/core.py are only being unit tested on modules that import from the file (if they have a corresponding test) or tests that import from the file themselves.
This commit is contained in:
parent
7a0c28cc37
commit
1fdd84b88c
2 changed files with 1 additions and 8 deletions
34
test/units/modules/cloud/amazon/test_aws_s3.py
Normal file
34
test/units/modules/cloud/amazon/test_aws_s3.py
Normal file
|
@ -0,0 +1,34 @@
|
|||
import pytest
|
||||
|
||||
import unittest
|
||||
|
||||
try:
|
||||
import ansible.modules.cloud.amazon.aws_s3 as s3
|
||||
except ImportError:
|
||||
pytestmark = pytest.mark.skip("This test requires the s3 Python libraries")
|
||||
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlparse
|
||||
|
||||
boto3 = pytest.importorskip("boto3")
|
||||
|
||||
|
||||
class TestUrlparse(unittest.TestCase):
|
||||
|
||||
def test_urlparse(self):
|
||||
actual = urlparse("http://test.com/here")
|
||||
self.assertEqual("http", actual.scheme)
|
||||
self.assertEqual("test.com", actual.netloc)
|
||||
self.assertEqual("/here", actual.path)
|
||||
|
||||
def test_is_fakes3(self):
|
||||
actual = s3.is_fakes3("fakes3://bla.blubb")
|
||||
self.assertEqual(True, actual)
|
||||
|
||||
def test_get_s3_connection(self):
|
||||
aws_connect_kwargs = dict(aws_access_key_id="access_key",
|
||||
aws_secret_access_key="secret_key")
|
||||
location = None
|
||||
rgw = True
|
||||
s3_url = "http://bla.blubb"
|
||||
actual = s3.get_s3_connection(None, aws_connect_kwargs, location, rgw, s3_url)
|
||||
self.assertEqual(bool("bla.blubb" in str(actual._endpoint)), True)
|
Loading…
Add table
Add a link
Reference in a new issue