Skip to content

Commit

Permalink
chore: adding unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eamonnfaherty committed May 24, 2023
1 parent a611238 commit c919fbf
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions servicecatalog_puppet/print_utils_unit_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from unittest import mock


@mock.patch("click.secho")
def test_echo(mocked_click_secho):
# setup
from servicecatalog_puppet import print_utils

message = "hello world"

# exercise
print_utils.echo(message)

# verify
mocked_click_secho.assert_called_once_with(message)


@mock.patch("click.secho")
def test_warn(mocked_click_secho):
from servicecatalog_puppet import print_utils

message = "hello world"

# exercise
print_utils.warn(message)

# verify
mocked_click_secho.assert_called_once_with(
message, err=True, fg="yellow",
)


@mock.patch("click.secho")
def test_error(mocked_click_secho):
from servicecatalog_puppet import print_utils

message = "hello world"

# exercise
print_utils.error(message)

# verify
mocked_click_secho.assert_called_once_with(
message, err=True, fg="red",
)

0 comments on commit c919fbf

Please sign in to comment.