コード例 #1
0
 def test_size_calculation(self):
     afile = CourseFile('name', 'url', '1000')
     asecondfile = CourseFile('name', 'url', '10001')
     afile.size = 1099776
     asecondfile.size = 752640
     complete_list = [(afile, '/his/path'), (asecondfile, '/another/path')]
     assert total_size(complete_list) == afile.size + asecondfile.size
コード例 #2
0
 def test_size_calculation(self):
     afile = CourseFile({'title': 'a',
                         'groupId': 5,
                         'uuid': '50-ddf-kek',
                         'size': 1000})
     asecondfile = CourseFile({'title': 'a',
                               'groupId': 5,
                               'uuid': '50-ddf-kek',
                               'size': 10001})
     afile.size = 1099776
     asecondfile.size = 752640
     complete_list = [(afile, '/his/path'), (asecondfile, '/another/path')]
     assert total_size(complete_list) == afile.size + asecondfile.size
コード例 #3
0
 def test_folder_size(self):
     COMMON_SIZE = 1099776
     a = CourseFile('name', 'url', '1000')
     b = CourseFile('name', 'url', '10001')
     c = CourseFile('name', 'url', '10001')
     d = CourseFile('name', 'url', '10001')
     e = CourseFile('name', 'url', '10001')
     f = CourseFile('name', 'url', '10001')
     a.size = COMMON_SIZE
     b.size = COMMON_SIZE
     c.size = COMMON_SIZE
     d.size = COMMON_SIZE
     e.size = COMMON_SIZE
     f.size = COMMON_SIZE
     top = Folder('top', 'url')
     middle = Folder('middle', 'url')
     bottom = Folder('bottom', 'url')
     top.files.append(a)
     middle.files.append(b)
     middle.files.append(c)
     bottom.files.append(d)
     bottom.files.append(e)
     bottom.files.append(f)
     middle.folders.append(bottom)
     top.folders.append(middle)
     sizes = []
     assert sum(folder_total_size(top, sizes)) == COMMON_SIZE * 6
コード例 #4
0
 def test_folder_size(self):
     COMMON_SIZE = 1099776
     a = CourseFile({'title': 'a',
                     'groupId': 5,
                     'uuid': '50-ddf-kek',
                     'size': 1000})
     b = CourseFile({'title': 'a',
                     'groupId': 5,
                     'uuid': '50-ddf-kek',
                     'size': 10001})
     c = CourseFile({'title': 'a',
                     'groupId': 5,
                     'uuid': '50-ddf-kek',
                     'size': 10001})
     d = CourseFile({'title': 'a',
                     'groupId': 5,
                     'uuid': '50-ddf-kek',
                     'size': 10001})
     e = CourseFile({'title': 'a',
                     'groupId': 5,
                     'uuid': '50-ddf-kek',
                     'size': 10001})
     f = CourseFile({'title': 'a',
                     'groupId': 5,
                     'uuid': '50-ddf-kek',
                     'size': 10001})
     a.size = COMMON_SIZE
     b.size = COMMON_SIZE
     c.size = COMMON_SIZE
     d.size = COMMON_SIZE
     e.size = COMMON_SIZE
     f.size = COMMON_SIZE
     top = Folder({'name': 'top', 'friendlyURL': 'url'})
     middle = Folder({'name': 'middle', 'friendlyURL': 'url'})
     bottom = Folder({'name': 'bottom', 'friendlyURL': 'url'})
     top.files.append(a)
     middle.files.append(b)
     middle.files.append(c)
     bottom.files.append(d)
     bottom.files.append(e)
     bottom.files.append(f)
     middle.folders.append(bottom)
     top.folders.append(middle)
     sizes = []
     assert sum(folder_total_size(top, sizes)) == COMMON_SIZE*6