Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
55eca4e7
Commit
55eca4e7
authored
Oct 23, 2018
by
PJ Janse van Rensburg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move test_fileadmin_sort_bogus_url_param() to local fileadmin test class.
parent
32f9bd9f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
34 deletions
+34
-34
test_fileadmin.py
flask_admin/tests/fileadmin/test_fileadmin.py
+34
-34
No files found.
flask_admin/tests/fileadmin/test_fileadmin.py
View file @
55eca4e7
...
...
@@ -138,40 +138,6 @@ class Base:
ok_
(
'path=dummy_renamed_dir'
not
in
rv
.
data
.
decode
(
'utf-8'
))
ok_
(
'path=dummy.txt'
in
rv
.
data
.
decode
(
'utf-8'
))
def
test_fileadmin_sort_bogus_url_param
(
self
):
fileadmin_class
=
self
.
fileadmin_class
()
fileadmin_args
,
fileadmin_kwargs
=
self
.
fileadmin_args
()
app
,
admin
=
setup
()
class
MyFileAdmin
(
fileadmin_class
):
editable_extensions
=
(
'txt'
,)
view_kwargs
=
dict
(
fileadmin_kwargs
)
view_kwargs
.
setdefault
(
'name'
,
'Files'
)
view
=
MyFileAdmin
(
*
fileadmin_args
,
**
view_kwargs
)
admin
.
add_view
(
view
)
client
=
app
.
test_client
()
with
open
(
op
.
join
(
self
.
_test_files_root
,
'dummy2.txt'
),
'w'
)
as
fp
:
# make sure that 'files/dummy2.txt' exists, is newest and has bigger size
fp
.
write
(
'test'
)
rv
=
client
.
get
(
'/admin/myfileadmin/?sort=bogus'
)
eq_
(
rv
.
status_code
,
200
)
ok_
(
rv
.
data
.
decode
(
'utf-8'
)
.
find
(
'path=dummy2.txt'
)
<
rv
.
data
.
decode
(
'utf-8'
)
.
find
(
'path=dummy.txt'
))
rv
=
client
.
get
(
'/admin/myfileadmin/?sort=name'
)
eq_
(
rv
.
status_code
,
200
)
ok_
(
rv
.
data
.
decode
(
'utf-8'
)
.
find
(
'path=dummy.txt'
)
<
rv
.
data
.
decode
(
'utf-8'
)
.
find
(
'path=dummy2.txt'
))
try
:
# clean up
os
.
remove
(
op
.
join
(
self
.
_test_files_root
,
'dummy2.txt'
))
except
(
IOError
,
OSError
):
pass
def
test_modal_edit
(
self
):
# bootstrap 2 - test edit_modal
app_bs2
=
Flask
(
__name__
)
...
...
@@ -243,3 +209,37 @@ class LocalFileAdminTests(Base.FileAdminTests):
def
fileadmin_args
(
self
):
return
(
self
.
_test_files_root
,
'/files'
),
{}
def
test_fileadmin_sort_bogus_url_param
(
self
):
fileadmin_class
=
self
.
fileadmin_class
()
fileadmin_args
,
fileadmin_kwargs
=
self
.
fileadmin_args
()
app
,
admin
=
setup
()
class
MyFileAdmin
(
fileadmin_class
):
editable_extensions
=
(
'txt'
,)
view_kwargs
=
dict
(
fileadmin_kwargs
)
view_kwargs
.
setdefault
(
'name'
,
'Files'
)
view
=
MyFileAdmin
(
*
fileadmin_args
,
**
view_kwargs
)
admin
.
add_view
(
view
)
client
=
app
.
test_client
()
with
open
(
op
.
join
(
self
.
_test_files_root
,
'dummy2.txt'
),
'w'
)
as
fp
:
# make sure that 'files/dummy2.txt' exists, is newest and has bigger size
fp
.
write
(
'test'
)
rv
=
client
.
get
(
'/admin/myfileadmin/?sort=bogus'
)
eq_
(
rv
.
status_code
,
200
)
ok_
(
rv
.
data
.
decode
(
'utf-8'
)
.
find
(
'path=dummy2.txt'
)
<
rv
.
data
.
decode
(
'utf-8'
)
.
find
(
'path=dummy.txt'
))
rv
=
client
.
get
(
'/admin/myfileadmin/?sort=name'
)
eq_
(
rv
.
status_code
,
200
)
ok_
(
rv
.
data
.
decode
(
'utf-8'
)
.
find
(
'path=dummy.txt'
)
<
rv
.
data
.
decode
(
'utf-8'
)
.
find
(
'path=dummy2.txt'
))
try
:
# clean up
os
.
remove
(
op
.
join
(
self
.
_test_files_root
,
'dummy2.txt'
))
except
(
IOError
,
OSError
):
pass
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment