Skip to content

Commit

Permalink
corrected tests for download_data
Browse files Browse the repository at this point in the history
  • Loading branch information
Sparrow0hawk committed Jan 28, 2021
1 parent 4e29261 commit d4eaa52
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/test_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,20 @@
class TestDownloadData(unittest.TestCase):

def test_download_success(self):
"""
A test to fetch a dummy data tar file using the download data function in utils
"""
open_mock = mock_open()

with patch("__main__.open", open_mock):
download_data()
with patch("builtins.open", open_mock):
download_data(url="https://example0blob0store.blob.core.windows.net/test1/dummy_data.tar.gz")

open_mock.assert_called_with("devon_data.tar.gz","wb")

def test_download_fail(self):
"""
A test the confirms an exception is raised if an invalid url is provided to download data
"""

with self.assertRaises(Exception):
download_data(url="not_a_url")
Expand Down

0 comments on commit d4eaa52

Please sign in to comment.