Skip to content

Commit 7d028dd

Browse files
author
Scisco
committed
add tests for force-unzip flag
1 parent 859df55 commit 7d028dd

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

landsat/tests/test_landsat.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,15 @@ def test_download_process_continuous(self, mock_downloader, mock_process):
101101
args = ['download', 'LC80010092015051LGN00', 'LC80010092014051LGN00', '-b', '432', '-d', self.mock_path, '-p']
102102
output = landsat.main(self.parser.parse_args(args))
103103
mock_downloader.assert_called_with(['LC80010092015051LGN00', 'LC80010092014051LGN00'], ['4', '3', '2'])
104-
mock_process.assert_called_with('path/to/folder/LC80010092014051LGN00', '432', False, False)
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)
105113
self.assertEquals(output, ["Image Processing Completed", 0])
106114

107115
@mock.patch('landsat.landsat.Uploader')
@@ -117,7 +125,7 @@ def test_download_process_continuous_with_upload(self, mock_downloader, mock_pro
117125
'-u', '--key', 'somekey', '--secret', 'somesecret', '--bucket', 'mybucket', '--region', 'this']
118126
output = landsat.main(self.parser.parse_args(args))
119127
mock_downloader.assert_called_with(['LC80010092015051LGN00'], ['4', '3', '2'])
120-
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)
121129
mock_upload.assert_called_with('somekey', 'somesecret', 'this')
122130
mock_upload.return_value.run.assert_called_with('mybucket', 'image.TIF', 'image.TIF')
123131
self.assertEquals(output, ["Image Processing Completed", 0])
@@ -133,7 +141,7 @@ def test_download_process_continuous_with_wrong_args(self, mock_downloader, mock
133141
'-u', '--region', 'whatever']
134142
output = landsat.main(self.parser.parse_args(args))
135143
mock_downloader.assert_called_with(['LC80010092015051LGN00'], ['4', '3', '2'])
136-
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)
137145
self.assertEquals(output, ['Could not authenticate with AWS', 1])
138146

139147
@mock.patch('landsat.landsat.process_image')
@@ -144,7 +152,7 @@ def test_process_correct(self, mock_process):
144152
args = ['process', 'path/to/folder/LC80010092015051LGN00']
145153
output = landsat.main(self.parser.parse_args(args))
146154

147-
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)
148156
self.assertEquals(output, ["The output is stored at image.TIF"])
149157

150158
@mock.patch('landsat.landsat.process_image')
@@ -155,7 +163,7 @@ def test_process_correct_pansharpen(self, mock_process):
155163
args = ['process', '--pansharpen', 'path/to/folder/LC80010092015051LGN00']
156164
output = landsat.main(self.parser.parse_args(args))
157165

158-
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)
159167
self.assertEquals(output, ["The output is stored at image.TIF"])
160168

161169
def test_process_incorrect(self):

0 commit comments

Comments
 (0)