Skip to content

Commit

Permalink
TST: test _get_file
Browse files Browse the repository at this point in the history
  • Loading branch information
jklenzing committed Aug 29, 2024
1 parent 2f27873 commit c29d81d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pysatNASA/tests/test_methods_cdaweb.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def test_bad_zip_warning_get_files(self, caplog):
temp_dir = tempfile.TemporaryDirectory()

with caplog.at_level(logging.WARNING, logger='pysat'):
cdw.get_file(req.content, '.', 'test.txt', temp_path=temp_dir.name,
zip_method='badzip')
cdw._get_file(req.content, '.', 'test.txt', temp_path=temp_dir.name,
zip_method='badzip')
captured = caplog.text

# Check for appropriate warning
Expand All @@ -119,6 +119,14 @@ def test_bad_zip_warning_get_files(self, caplog):

return

def test_get_file_unzip_without_temp_path(self):
"""Test that warning when cdf file does not have expected params."""

with pytest.raises(ValueError) as excinfo:
cdw._get_file('remote_file', 'fake_path', 'fname', zip_method='zip')
assert str(excinfo.value).find('Temp path needs') >= 0
return

@pytest.mark.parametrize("bad_key,bad_val,err_msg",
[("tag", "badval", "inst_id / tag combo unknown."),
("inst_id", "badval",
Expand Down

0 comments on commit c29d81d

Please sign in to comment.