-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a611238
commit c919fbf
Showing
1 changed file
with
47 additions
and
0 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 |
---|---|---|
@@ -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", | ||
) |