@@ -17,27 +17,32 @@ class TestRunCommand(object):
1717
1818 @mock .patch ("paperspace.client.requests.post" )
1919 @mock .patch ("paperspace.workspace.WorkspaceHandler._zip_workspace" )
20+ @mock .patch ("paperspace.workspace.MultipartEncoder.get_monitor" )
2021 @mock .patch ("paperspace.commands.jobs.CreateJobCommand._get_files_dict" )
21- def test_run_simple_file_with_args (self , get_files_patched , workspace_zip_patched , post_patched ):
22+ def test_run_simple_file_with_args (self , get_files_patched , get_moniror_patched , workspace_zip_patched , post_patched ):
2223 get_files_patched .return_value = mock .MagicMock ()
2324 workspace_zip_patched .return_value = '/foo/bar'
2425 post_patched .return_value = MockResponse (status_code = 200 )
2526
27+ mock_monitor = mock .MagicMock ()
28+ mock_monitor .content_type = "mock/multipart"
29+
30+ get_moniror_patched .return_value = mock_monitor
31+
2632 runner = CliRunner ()
2733 result = runner .invoke (cli .cli , [self .command_name ] + self .common_commands + ["/myscript.py" , "a" , "b" ])
2834
2935 expected_headers = self .headers .copy ()
3036 expected_headers .update ({
31- 'Content-Type' : "multipart/form-data "
37+ 'Content-Type' : "mock/multipart "
3238 })
3339 post_patched .assert_called_with (self .url ,
3440 params = {'name' : u'test' , 'projectId' : u'projectId' ,
3541 'workspaceFileName' : 'bar' ,
3642 'command' : 'python{} myscript.py a b' .format (str (sys .version_info [0 ])),
37- 'projectHandle' : u'projectId' ,
3843 'container' : u'paperspace/tensorflow-python' },
39- data = None ,
40- files = mock . ANY ,
44+ data = mock . ANY ,
45+ files = None ,
4146 headers = expected_headers ,
4247 json = None )
4348
@@ -55,7 +60,6 @@ def test_run_python_command_with_args_and_no_workspace(self, post_patched):
5560 'workspaceFileName' : 'none' ,
5661 'workspace' : 'none' ,
5762 'command' : 'python{} -c print(foo)' .format (str (sys .version_info [0 ])),
58- 'projectHandle' : u'projectId' ,
5963 'container' : u'paperspace/tensorflow-python' },
6064 data = None ,
6165 files = None ,
@@ -79,7 +83,6 @@ def test_run_shell_command_with_args_with_s3_workspace(self, workspace_zip_patch
7983 'workspaceFileName' : 's3://bucket/object' ,
8084 'workspaceUrl' : 's3://bucket/object' ,
8185 'command' : 'echo foo' ,
82- 'projectHandle' : u'projectId' ,
8386 'container' : u'paperspace/tensorflow-python' },
8487 data = None ,
8588 files = None ,
0 commit comments