-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(init-templates): use pytest for Python sample-app init template
Fixes #5313
- Loading branch information
Showing
1 changed file
with
15 additions
and
6 deletions.
There are no files selected for viewing
21 changes: 15 additions & 6 deletions
21
...ges/aws-cdk/lib/init-templates/sample-app/python/tests/unit/test_%name%_stack.template.py
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 |
---|---|---|
@@ -1,11 +1,20 @@ | ||
import unittest | ||
import json | ||
import pytest | ||
|
||
from aws_cdk import core | ||
from %name%.%name%_stack import %name.PascalCased%Stack | ||
|
||
from hello.hello_construct import HelloConstruct | ||
|
||
class Test%name.PascalCased%Stack(unittest.TestCase): | ||
def get_template(): | ||
app = core.App() | ||
%name.PascalCased%Stack(app, "%name%") | ||
return json.dumps(app.synth().get_stack("%name%").template) | ||
|
||
def setUp(self): | ||
self.app = core.App() | ||
self.stack = core.Stack(self.app, "TestStack") | ||
|
||
def test_sqs_queue_created(): | ||
template_json = get_template() | ||
assert("AWS::SQS::Queue" in get_template()) | ||
|
||
|
||
def test_sns_topic_created(): | ||
assert("AWS::SNS::Topic" in get_template()) |