Skip to content

Commit

Permalink
Added Unit tests for get_s3_bucket_from_stage() (#1051)
Browse files Browse the repository at this point in the history
* Unit_test_case

* minute_changes

* linter_check

* check expected outcome

---------

Co-authored-by: GP Saggese <33238329+gpsaggese@users.noreply.github.com>
  • Loading branch information
mayank922 and gpsaggese authored Jun 21, 2024
1 parent fc998b1 commit aae2ca9
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions helpers/test/test_hs3.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,50 @@ def test2(self) -> None:
region=test_default_region
"""
self.helper(file_name, expected)


# #############################################################################


class Test_get_s3_bucket_from_stage(hunitest.TestCase):
def test1(self) -> None:
"""
Check for a valid stage.
"""
# Define arguments.
stage = "test"
# Run.
actual = hs3.get_s3_bucket_from_stage(stage)
expected = "cryptokaizen-data-test"
self.assert_equal(actual, expected)

def test2(self) -> None:
"""
Check for a valid stage and optional suffix.
"""
# Define arguments.
stage = "preprod"
suffix = "suffix_test"
# Run.
actual = hs3.get_s3_bucket_from_stage(stage, add_suffix=suffix)
expected = "cryptokaizen-data.preprod/suffix_test"
self.assert_equal(actual, expected)

def test3(self) -> None:
"""
Check Invalid stage.
"""
# Define arguments.
stage = "Invalid"
# Run.
with self.assertRaises(AssertionError) as cm:
hs3.get_s3_bucket_from_stage(stage)
actual = str(cm.exception)
expected = r"""
* Failed assertion *
'Invalid' in '{'test': 'cryptokaizen-data-test', 'preprod': 'cryptokaizen-data.preprod', 'prod': 'cryptokaizen-data'}'
"""
self.assert_equal(actual, expected, fuzzy_match=True)


# #############################################################################

0 comments on commit aae2ca9

Please sign in to comment.