Skip to content

Commit 1f75b5f

Browse files
committed
Temp commit, plz rebase/ammend [skip test]
1 parent 0e41e88 commit 1f75b5f

File tree

10 files changed

+46
-137
lines changed

10 files changed

+46
-137
lines changed

tests/extensions/zip/__init__.py

Whitespace-only changes.

tests/extensions/zip/files/empty.zip

-22 Bytes
Binary file not shown.
-6.62 KB
Binary file not shown.

tests/extensions/zip/files/test.zip

-4.08 KB
Binary file not shown.
146 Bytes
Binary file not shown.
6.98 KB
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"file_tree":[
3+
{
4+
"text":"zip-test.zip",
5+
"icon":"http://mfr.osf.io/assets/zip/img/file_ext_zip.png",
6+
"children":[]
7+
}
8+
]
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"file_tree":[
3+
{
4+
"text":"zip-empty.zip",
5+
"icon":"http://mfr.osf.io/assets/zip/img/file_ext_zip.png",
6+
"children":[]
7+
}
8+
]
9+
}

tests/extensions/zip/fixtures/fixtures.json

Lines changed: 0 additions & 117 deletions
This file was deleted.

tests/extensions/zip/test_renderer.py

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import os
2-
import re
32
import json
43
from zipfile import ZipFile
54

65
import pytest
76

8-
from mfr.core.provider import ProviderMetadata
97
from mfr.extensions.zip import ZipRenderer
10-
8+
from mfr.core.provider import ProviderMetadata
119

1210
BASE = os.path.dirname(os.path.abspath(__file__))
1311

@@ -20,18 +18,27 @@ def metadata():
2018
'1234',
2119
'http://wb.osf.io/file/test.zip?token=1234')
2220

21+
2322
@pytest.fixture
2423
def zip_file():
25-
return ZipFile(os.path.join(BASE, 'files', 'test.zip'), 'r')
24+
return ZipFile(os.path.join(BASE, 'files', 'zip-test.zip'), 'r')
25+
2626

2727
@pytest.fixture
28-
def zip_file_tree():
29-
return ZipFile(os.path.join(BASE, 'files', 'test-tree.zip'), 'r')
28+
def zip_file_empty():
29+
return ZipFile(os.path.join(BASE, 'files', 'zip-empty.zip'), 'r')
3030

3131

3232
@pytest.fixture
33-
def zip_empty_file():
34-
return ZipFile(os.path.join(BASE, 'files', 'empty.zip'), 'r')
33+
def expected_file_tree():
34+
with open(os.path.join(os.path.dirname(__file__), 'fixtures/file_tree.json'), 'r') as fp:
35+
return json.load(fp)['file_tree']
36+
37+
38+
@pytest.fixture
39+
def expected_file_tree_empty():
40+
with open(os.path.join(os.path.dirname(__file__), 'fixtures/file_tree_empty.json'), 'r') as fp:
41+
return json.load(fp)['file_tree']
3542

3643

3744
@pytest.fixture
@@ -59,21 +66,22 @@ def renderer(metadata, test_file_path, url, assets_url, export_url):
5966
return ZipRenderer(metadata, test_file_path, url, assets_url, export_url)
6067

6168

62-
@pytest.fixture
63-
def file_tree():
64-
with open(os.path.join(os.path.dirname(__file__), 'fixtures/fixtures.json'), 'r') as fp:
65-
return json.load(fp)['file_tree']
66-
67-
6869
class TestZipRenderer:
6970

70-
def test_render(self, renderer):
71-
body = renderer.render()
71+
def test_render(self):
72+
pass
73+
74+
def test_sanitize_obj_list(self):
75+
pass
7276

73-
def test_filelist_to_tree(self, renderer, zip_file_tree, file_tree):
77+
def test_find_node_among_siblings(self):
78+
pass
7479

75-
files = [file for file in zip_file_tree.filelist if not file.filename.startswith('__MACOSX')]
80+
def test_icon_exists(self):
81+
pass
7682

77-
actual = renderer.filelist_to_tree(files)
78-
assert actual == file_tree
83+
def update_node_with_attributes(self):
84+
pass
7985

86+
def test_obj_list_to_tree(self):
87+
pass

0 commit comments

Comments
 (0)