@@ -94,45 +94,54 @@ def test_download_incorrect(self):
9494 @mock .patch ('landsat.landsat.Downloader.download' )
9595 def test_download_process_continuous (self , mock_downloader , mock_process ):
9696 """Test download and process commands together"""
97- mock_downloader .return_value = True
97+ mock_downloader .return_value = {'LC80010092015051LGN00' : 'aws' ,
98+ 'LC80010092014051LGN00' : 'aws' }
9899 mock_process .return_value = 'image.TIF'
99100
100- args = ['download' , 'LC80010092015051LGN00' , '-b' , '432' , '-d' , self .mock_path , '-p' ]
101+ args = ['download' , 'LC80010092015051LGN00' , 'LC80010092014051LGN00' , ' -b' , '432' , '-d' , self .mock_path , '-p' ]
101102 output = landsat .main (self .parser .parse_args (args ))
102- mock_downloader .assert_called_with (['LC80010092015051LGN00' ], ['4' , '3' , '2' ])
103- mock_process .assert_called_with ('path/to/folder/LC80010092015051LGN00' , '432' , False , False )
104- self .assertEquals (output , ["The output is stored at image.TIF" ])
103+ mock_downloader .assert_called_with (['LC80010092015051LGN00' , 'LC80010092014051LGN00' ], ['4' , '3' , '2' ])
104+ mock_process .assert_called_with ('path/to/folder/LC80010092014051LGN00' , '432' , False , False , False )
105+ self .assertEquals (output , ["Image Processing Completed" , 0 ])
106+
107+ # Call with force unzip flag
108+ args = ['download' , 'LC80010092015051LGN00' , 'LC80010092014051LGN00' , '-b' , '432' , '-d' ,
109+ self .mock_path , '-p' , '--force-unzip' ]
110+ output = landsat .main (self .parser .parse_args (args ))
111+ mock_downloader .assert_called_with (['LC80010092015051LGN00' , 'LC80010092014051LGN00' ], ['4' , '3' , '2' ])
112+ mock_process .assert_called_with ('path/to/folder/LC80010092014051LGN00' , '432' , False , False , True )
113+ self .assertEquals (output , ["Image Processing Completed" , 0 ])
105114
106115 @mock .patch ('landsat.landsat.Uploader' )
107116 @mock .patch ('landsat.landsat.process_image' )
108117 @mock .patch ('landsat.landsat.Downloader.download' )
109118 def test_download_process_continuous_with_upload (self , mock_downloader , mock_process , mock_upload ):
110119 """Test download and process commands together"""
111- mock_downloader .return_value = True
120+ mock_downloader .return_value = { 'LC80010092015051LGN00' : 'aws' }
112121 mock_process .return_value = 'image.TIF'
113122 mock_upload .run .return_value = True
114123
115124 args = ['download' , 'LC80010092015051LGN00' , '-b' , '432' , '-d' , self .mock_path , '-p' ,
116125 '-u' , '--key' , 'somekey' , '--secret' , 'somesecret' , '--bucket' , 'mybucket' , '--region' , 'this' ]
117126 output = landsat .main (self .parser .parse_args (args ))
118127 mock_downloader .assert_called_with (['LC80010092015051LGN00' ], ['4' , '3' , '2' ])
119- mock_process .assert_called_with ('path/to/folder/LC80010092015051LGN00' , '432' , False , False )
128+ mock_process .assert_called_with ('path/to/folder/LC80010092015051LGN00' , '432' , False , False , False )
120129 mock_upload .assert_called_with ('somekey' , 'somesecret' , 'this' )
121130 mock_upload .return_value .run .assert_called_with ('mybucket' , 'image.TIF' , 'image.TIF' )
122- self .assertEquals (output , ["The output is stored at image.TIF" ])
131+ self .assertEquals (output , ["Image Processing Completed" , 0 ])
123132
124133 @mock .patch ('landsat.landsat.process_image' )
125134 @mock .patch ('landsat.landsat.Downloader.download' )
126135 def test_download_process_continuous_with_wrong_args (self , mock_downloader , mock_process ):
127136 """Test download and process commands together"""
128- mock_downloader .return_value = True
137+ mock_downloader .return_value = { 'LC80010092015051LGN00' : 'aws' }
129138 mock_process .return_value = 'image.TIF'
130139
131140 args = ['download' , 'LC80010092015051LGN00' , '-b' , '432' , '-d' , self .mock_path , '-p' ,
132141 '-u' , '--region' , 'whatever' ]
133142 output = landsat .main (self .parser .parse_args (args ))
134143 mock_downloader .assert_called_with (['LC80010092015051LGN00' ], ['4' , '3' , '2' ])
135- mock_process .assert_called_with ('path/to/folder/LC80010092015051LGN00' , '432' , False , False )
144+ mock_process .assert_called_with ('path/to/folder/LC80010092015051LGN00' , '432' , False , False , False )
136145 self .assertEquals (output , ['Could not authenticate with AWS' , 1 ])
137146
138147 @mock .patch ('landsat.landsat.process_image' )
@@ -143,7 +152,7 @@ def test_process_correct(self, mock_process):
143152 args = ['process' , 'path/to/folder/LC80010092015051LGN00' ]
144153 output = landsat .main (self .parser .parse_args (args ))
145154
146- mock_process .assert_called_with ('path/to/folder/LC80010092015051LGN00' , None , False , False )
155+ mock_process .assert_called_with ('path/to/folder/LC80010092015051LGN00' , None , False , False , False )
147156 self .assertEquals (output , ["The output is stored at image.TIF" ])
148157
149158 @mock .patch ('landsat.landsat.process_image' )
@@ -154,7 +163,7 @@ def test_process_correct_pansharpen(self, mock_process):
154163 args = ['process' , '--pansharpen' , 'path/to/folder/LC80010092015051LGN00' ]
155164 output = landsat .main (self .parser .parse_args (args ))
156165
157- mock_process .assert_called_with ('path/to/folder/LC80010092015051LGN00' , None , False , True )
166+ mock_process .assert_called_with ('path/to/folder/LC80010092015051LGN00' , None , False , True , False )
158167 self .assertEquals (output , ["The output is stored at image.TIF" ])
159168
160169 def test_process_incorrect (self ):
0 commit comments