aboutsummaryrefslogtreecommitdiff
path: root/backend/tests/eol/test_download_imgs.py
diff options
context:
space:
mode:
authorTerry Truong <terry06890@gmail.com>2023-01-29 11:30:47 +1100
committerTerry Truong <terry06890@gmail.com>2023-01-29 11:30:47 +1100
commit8781fdb2b8c530a6c1531ae9e82221eb062e34fb (patch)
treeffd824aa9b945d69b47f012617ee13d98764d078 /backend/tests/eol/test_download_imgs.py
parentf5e87ae628bab0eef97b3e3e62f6d71cca9c99c0 (diff)
Adjust backend coding style
Add line spacing, section comments, and import consistency
Diffstat (limited to 'backend/tests/eol/test_download_imgs.py')
-rw-r--r--backend/tests/eol/test_download_imgs.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/backend/tests/eol/test_download_imgs.py b/backend/tests/eol/test_download_imgs.py
index 975d1c7..4872ca3 100644
--- a/backend/tests/eol/test_download_imgs.py
+++ b/backend/tests/eol/test_download_imgs.py
@@ -1,6 +1,7 @@
import unittest
from unittest.mock import Mock, patch
-import tempfile, os
+import tempfile
+import os
from tests.common import readTestFile, createTestDbTable
from tol_data.eol.download_imgs import getEolIdsFromDb, downloadImgs
@@ -19,8 +20,10 @@ class TestGetEolIdsFromDb(unittest.TestCase):
('a second', 2),
}
)
+
# Run
eolIds = getEolIdsFromDb(dbFile)
+
# Check
self.assertEqual(eolIds, {1, 2})
@@ -30,6 +33,7 @@ class TestDownloadImgs(unittest.TestCase):
requestsGetMock.side_effect = lambda url: Mock(content=('img:' + url).encode())
with tempfile.TemporaryDirectory() as tempDir:
eolIds = {1, 2, 4}
+
# Create temp images-list db
imagesListDb = os.path.join(tempDir, 'images_list.db')
createTestDbTable(
@@ -48,10 +52,12 @@ class TestDownloadImgs(unittest.TestCase):
(30, 3, '', 'https://content.eol.org/3.png', 'cc-by', 'owner3'),
}
)
+
# Create temp output dir
with tempfile.TemporaryDirectory() as outDir:
# Run
downloadImgs(eolIds, imagesListDb, outDir)
+
# Check
expectedImgs1 = {
'1 10.jpg': 'img:https://content.eol.org/1.jpg',