|
|
@@ -463,8 +463,8 @@ def test_listdir():
|
|
|
resp = c.get(url)
|
|
|
|
|
|
# We are actually reading a directory
|
|
|
- assert_equal('.', resp.context['files'][0]['name'])
|
|
|
- assert_equal('..', resp.context['files'][1]['name'])
|
|
|
+ assert_equal('.', resp.context['files'][1]['name'])
|
|
|
+ assert_equal('..', resp.context['files'][0]['name'])
|
|
|
|
|
|
# Test's home directory now exists. Should be returned.
|
|
|
c = make_logged_in_client()
|
|
|
@@ -510,7 +510,7 @@ def test_listdir_sort_and_filter():
|
|
|
cluster.fs.mkdir(cluster.fs.join(BASE, FUNNY_NAME))
|
|
|
|
|
|
# All 12 of the entries
|
|
|
- expect = [ '.', '..', FUNNY_NAME] + [ str(i) for i in range(1, 11) ]
|
|
|
+ expect = [ '..', '.', FUNNY_NAME] + [ str(i) for i in range(1, 11) ]
|
|
|
|
|
|
# Check pagination
|
|
|
listing = c.get('/filebrowser/view' + BASE + '?pagesize=20').context['files']
|
|
|
@@ -527,14 +527,14 @@ def test_listdir_sort_and_filter():
|
|
|
|
|
|
# Check sorting (name)
|
|
|
listing = c.get('/filebrowser/view' + BASE + '?sortby=name').context['files']
|
|
|
- assert_equal(sorted(expect), [ f['name'] for f in listing ])
|
|
|
+ assert_equal(sorted(expect[2:]), [ f['name'] for f in listing ][2:])
|
|
|
|
|
|
listing = c.get('/filebrowser/view' + BASE + '?sortby=name&descending=false').context['files']
|
|
|
- assert_equal(sorted(expect), [ f['name'] for f in listing ])
|
|
|
+ assert_equal(sorted(expect[2:]), [ f['name'] for f in listing ][2:])
|
|
|
|
|
|
listing = c.get('/filebrowser/view' + BASE + '?sortby=name&descending=true').context['files']
|
|
|
- assert_equal(".", listing[0]['name'])
|
|
|
- assert_equal("..", listing[1]['name'])
|
|
|
+ assert_equal(".", listing[1]['name'])
|
|
|
+ assert_equal("..", listing[0]['name'])
|
|
|
assert_equal(FUNNY_NAME, listing[2]['name'])
|
|
|
|
|
|
# Check sorting (size)
|
|
|
@@ -543,24 +543,24 @@ def test_listdir_sort_and_filter():
|
|
|
|
|
|
# Check sorting (mtime)
|
|
|
listing = c.get('/filebrowser/view' + BASE + '?sortby=mtime').context['files']
|
|
|
- assert_equal(".", listing[0]['name'])
|
|
|
- assert_equal("..", listing[1]['name'])
|
|
|
+ assert_equal(".", listing[1]['name'])
|
|
|
+ assert_equal("..", listing[0]['name'])
|
|
|
assert_equal(FUNNY_NAME, listing[-1]['name'])
|
|
|
|
|
|
# Check filter
|
|
|
listing = c.get('/filebrowser/view' + BASE + '?filter=1').context['files']
|
|
|
- assert_equal(['.', '..', '1', '10'], [ f['name'] for f in listing ])
|
|
|
+ assert_equal(['..', '.', '1', '10'], [ f['name'] for f in listing ])
|
|
|
|
|
|
listing = c.get('/filebrowser/view' + BASE + '?filter=' + FUNNY_NAME).context['files']
|
|
|
- assert_equal(['.', '..', FUNNY_NAME], [ f['name'] for f in listing ])
|
|
|
+ assert_equal(['..', '.', FUNNY_NAME], [ f['name'] for f in listing ])
|
|
|
|
|
|
# Check filter + sorting
|
|
|
listing = c.get('/filebrowser/view' + BASE + '?filter=1&sortby=name&descending=true').context['files']
|
|
|
- assert_equal(['.', '..', '10', '1'], [ f['name'] for f in listing ])
|
|
|
+ assert_equal(['..', '.', '10', '1'], [ f['name'] for f in listing ])
|
|
|
|
|
|
# Check filter + sorting + pagination
|
|
|
listing = c.get('/filebrowser/view' + BASE + '?filter=1&sortby=name&descending=true&pagesize=1&pagenum=2').context['files']
|
|
|
- assert_equal(['.', '..', '1'], [ f['name'] for f in listing ])
|
|
|
+ assert_equal(['..', '.', '1'], [ f['name'] for f in listing ])
|
|
|
finally:
|
|
|
try:
|
|
|
cluster.fs.rmtree(BASE)
|