@@ -14,25 +14,22 @@ class TestGlobalToolInstallAction(TestCase):
14
14
def setUp (self , MockSubprocessDotnetCLI ):
15
15
self .subprocess_dotnet = MockSubprocessDotnetCLI .return_value
16
16
17
- def test_global_tool_install (self ):
17
+ def tearDown (self ):
18
18
self .subprocess_dotnet .reset_mock ()
19
19
20
+ def test_global_tool_install (self ):
20
21
action = GlobalToolInstallAction (self .subprocess_dotnet )
21
22
action .execute ()
22
23
self .subprocess_dotnet .run .assert_called_once_with (['tool' , 'install' , '-g' , 'Amazon.Lambda.Tools' ])
23
24
24
25
def test_global_tool_update (self ):
25
- self .subprocess_dotnet .reset_mock ()
26
-
27
26
self .subprocess_dotnet .run .side_effect = [DotnetCLIExecutionError (message = "Already Installed" ), None ]
28
27
action = GlobalToolInstallAction (self .subprocess_dotnet )
29
28
action .execute ()
30
29
self .subprocess_dotnet .run .assert_any_call (['tool' , 'install' , '-g' , 'Amazon.Lambda.Tools' ])
31
30
self .subprocess_dotnet .run .assert_any_call (['tool' , 'update' , '-g' , 'Amazon.Lambda.Tools' ])
32
31
33
32
def test_global_tool_update_failed (self ):
34
- self .subprocess_dotnet .reset_mock ()
35
-
36
33
self .subprocess_dotnet .run .side_effect = [DotnetCLIExecutionError (message = "Already Installed" ),
37
34
DotnetCLIExecutionError (message = "Updated Failed" )]
38
35
action = GlobalToolInstallAction (self .subprocess_dotnet )
@@ -50,27 +47,28 @@ def setUp(self, MockSubprocessDotnetCLI, MockOSUtils):
50
47
self .artifacts_dir = os .path .join ('/artifacts_dir' )
51
48
self .scratch_dir = os .path .join ('/scratch_dir' )
52
49
53
- def test_build_package (self ):
50
+ def tearDown (self ):
54
51
self .subprocess_dotnet .reset_mock ()
55
52
53
+ def test_build_package (self ):
54
+ mode = "Release"
55
+
56
56
options = {}
57
- action = RunPackageAction (self .source_dir , self .subprocess_dotnet , self .artifacts_dir , options , self .os_utils )
57
+ action = RunPackageAction (self .source_dir , self .subprocess_dotnet , self .artifacts_dir , options , mode ,
58
+ self .os_utils )
58
59
59
60
action .execute ()
60
61
61
- if platform .system ().lower () == 'windows' :
62
- zipFilePath = '/artifacts_dir\\ source_dir.zip'
63
- else :
64
- zipFilePath = '/artifacts_dir/source_dir.zip'
62
+ zipFilePath = os .path .join ('/' , 'artifacts_dir' , 'source_dir.zip' )
65
63
66
64
self .subprocess_dotnet .run .assert_called_once_with (['lambda' , 'package' , '--output-package' , zipFilePath ],
67
65
cwd = '/source_dir' )
68
66
69
67
def test_build_package_arguments (self ):
70
- self .subprocess_dotnet .reset_mock ()
71
-
68
+ mode = "Release"
72
69
options = {"--framework" : "netcoreapp2.1" }
73
- action = RunPackageAction (self .source_dir , self .subprocess_dotnet , self .artifacts_dir , options , self .os_utils )
70
+ action = RunPackageAction (self .source_dir , self .subprocess_dotnet , self .artifacts_dir , options , mode ,
71
+ self .os_utils )
74
72
75
73
action .execute ()
76
74
@@ -84,10 +82,25 @@ def test_build_package_arguments(self):
84
82
cwd = '/source_dir' )
85
83
86
84
def test_build_error (self ):
87
- self . subprocess_dotnet . reset_mock ()
85
+ mode = "Release"
88
86
89
87
self .subprocess_dotnet .run .side_effect = DotnetCLIExecutionError (message = "Failed Package" )
90
88
options = {}
91
- action = RunPackageAction (self .source_dir , self .subprocess_dotnet , self .artifacts_dir , options , self .os_utils )
89
+ action = RunPackageAction (self .source_dir , self .subprocess_dotnet , self .artifacts_dir , options , mode ,
90
+ self .os_utils )
92
91
93
92
self .assertRaises (ActionFailedError , action .execute )
93
+
94
+ def test_debug_configuration_set (self ):
95
+ mode = "Debug"
96
+ options = None
97
+ action = RunPackageAction (self .source_dir , self .subprocess_dotnet , self .artifacts_dir , options , mode ,
98
+ self .os_utils )
99
+
100
+ zipFilePath = os .path .join ('/' , 'artifacts_dir' , 'source_dir.zip' )
101
+
102
+ action .execute ()
103
+
104
+ self .subprocess_dotnet .run .assert_called_once_with (
105
+ ['lambda' , 'package' , '--output-package' , zipFilePath , '--configuration' , 'Debug' ],
106
+ cwd = '/source_dir' )
0 commit comments