Skip to content

Commit

Permalink
Closes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
willu47 committed Aug 16, 2021
1 parent 942aa2e commit 472ca0e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/scorm_package/scorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,13 @@ def zip_directory(dir_name):

# logging the list of all files to be zipped
logger.info('The following list of files will be zipped:')
for fileName in filePaths:
logger.info(fileName)

# writing files to a zipfile
with zipfile.ZipFile(os.path.join(dir_name, dir_name + '.zip'), 'w') as zip_file:
with zipfile.ZipFile(dir_name + '.zip', 'w') as zip_file:
# writing each file one by one
for file_name in filePaths:
arc_name = os.path.relpath(file_name, dir_name)
logger.info(f"{file_name}: {arc_name}")
zip_file.write(file_name, arc_name)

logger.info(f"{dir_name}.zip file was created successfully!")
Expand Down
4 changes: 2 additions & 2 deletions tests/test_scorm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from scorm_package.scorm import render_template, resourcelist
from scorm_package.scorm import render_template, resourcelist, retrieve_file_paths
import os

def test_template_render_organisations():
Expand Down Expand Up @@ -67,4 +67,4 @@ def test_resource_list():

actual = resourcelist(os.path.join('tests', 'fixtures', 'resourcelist'))
expected = ['res/1.html', 'res/2.html', 'res/3.html']
assert actual == expected
assert actual == expected

0 comments on commit 472ca0e

Please sign in to comment.