File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ def print_template(config: CallyStackServiceConfig):
1818 click .secho (action .print ())
1919
2020
21- @click .command (name = 'write' )
21+ @click .command (name = 'write' , cls = CallyStackServiceCommand () )
2222@click .option (
2323 '--output' ,
2424 type = click .Path (path_type = Path ),
Original file line number Diff line number Diff line change 11import json
22import os
3+ from pathlib import Path
34from unittest import mock
45
56from click .testing import CliRunner
@@ -23,3 +24,25 @@ def test_empty_print(self):
2324 json .loads (result .output ).get ('terraform' ),
2425 testdata ,
2526 )
27+
28+ @mock .patch .dict (os .environ , {"CALLY_STACK_TYPE" : "CallyStack" })
29+ def test_empty_write (self ):
30+ data = Path (self .working .name , 'cdk.tf.json' )
31+ result = CliRunner ().invoke (
32+ tf ,
33+ [
34+ 'write' ,
35+ '--service' ,
36+ 'test' ,
37+ '--environment' ,
38+ 'test' ,
39+ '--output' ,
40+ data .as_posix (),
41+ ],
42+ )
43+ self .assertEqual (result .exit_code , 0 )
44+ testdata = {"backend" : {"local" : {"path" : "state/test/test" }}}
45+ self .assertDictEqual (
46+ json .loads (data .read_text (encoding = 'utf8' )).get ('terraform' ),
47+ testdata ,
48+ )
You can’t perform that action at this time.
0 commit comments