Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
ed2fa4cd
Commit
ed2fa4cd
authored
Apr 28, 2021
by
Ozzie Isaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update error handling for user list (#1938)
parent
de7f039b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
89 deletions
+87
-89
admin.py
cps/admin.py
+19
-5
Calibre-Web TestSummary_Linux.html
test/Calibre-Web TestSummary_Linux.html
+68
-84
No files found.
cps/admin.py
View file @
ed2fa4cd
...
...
@@ -47,7 +47,7 @@ from .helper import check_valid_domain, send_test_mail, reset_password, generate
valid_email
,
check_username
from
.gdriveutils
import
is_gdrive_ready
,
gdrive_support
from
.render_template
import
render_title_template
,
get_sidebar_config
from
.
import
debug_info
from
.
import
debug_info
,
_BABEL_TRANSLATIONS
try
:
from
functools
import
wraps
...
...
@@ -369,13 +369,13 @@ def edit_list_user(param):
if
"pk[]"
in
vals
:
users
=
all_user
.
filter
(
ub
.
User
.
id
.
in_
(
vals
[
'pk[]'
]))
.
all
()
else
:
return
""
return
_
(
"Malformed request"
),
400
if
'field_index'
in
vals
:
vals
[
'field_index'
]
=
vals
[
'field_index'
][
0
]
if
'value'
in
vals
:
vals
[
'value'
]
=
vals
[
'value'
][
0
]
elif
not
(
'value[]'
in
vals
):
return
""
return
_
(
"Malformed request"
),
400
for
user
in
users
:
try
:
if
param
in
[
'denied_tags'
,
'allowed_tags'
,
'allowed_column_value'
,
'denied_column_value'
]:
...
...
@@ -418,9 +418,23 @@ def edit_list_user(param):
elif
param
==
'locale'
:
if
user
.
name
==
"Guest"
:
raise
Exception
(
_
(
"Guest's Locale is determined automatically and can't be set"
))
if
vals
[
'value'
]
in
_BABEL_TRANSLATIONS
:
user
.
locale
=
vals
[
'value'
]
else
:
raise
Exception
(
_
(
"No Valid Locale Given"
))
elif
param
==
'default_language'
:
languages
=
calibre_db
.
session
.
query
(
db
.
Languages
)
\
.
join
(
db
.
books_languages_link
)
\
.
join
(
db
.
Books
)
\
.
filter
(
calibre_db
.
common_filters
())
\
.
group_by
(
text
(
'books_languages_link.lang_code'
))
.
all
()
lang_codes
=
[
lang
.
lang_code
for
lang
in
languages
]
+
[
"all"
]
if
vals
[
'value'
]
in
lang_codes
:
user
.
default_language
=
vals
[
'value'
]
else
:
raise
Exception
(
_
(
"No Valid Book Language Given"
))
else
:
return
_
(
"Parameter not found"
),
400
except
Exception
as
ex
:
log
.
debug_or_exception
(
ex
)
return
str
(
ex
),
400
...
...
test/Calibre-Web TestSummary_Linux.html
View file @
ed2fa4cd
...
...
@@ -37,14 +37,14 @@
<div
class=
"row"
>
<div
class=
"col-xs-6 col-md-6 col-sm-offset-3"
style=
"margin-top:50px;"
>
<p
class=
'text-justify attribute'
><strong>
Start Time:
</strong>
2021-04-2
6 08:28:54
</p>
<p
class=
'text-justify attribute'
><strong>
Start Time:
</strong>
2021-04-2
7 20:06:09
</p>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-xs-6 col-md-6 col-sm-offset-3"
>
<p
class=
'text-justify attribute'
><strong>
Stop Time:
</strong>
2021-04-2
6 11:26:09
</p>
<p
class=
'text-justify attribute'
><strong>
Stop Time:
</strong>
2021-04-2
7 23:04:55
</p>
</div>
</div>
...
...
@@ -1269,12 +1269,12 @@
<tr
id=
"su"
class=
"
pass
Class"
>
<tr
id=
"su"
class=
"
error
Class"
>
<td>
TestEditBooksOnGdrive
</td>
<td
class=
"text-center"
>
20
</td>
<td
class=
"text-center"
>
20
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
18
</td>
<td
class=
"text-center"
>
1
</td>
<td
class=
"text-center"
>
1
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
<a
onclick=
"showClassDetail('c13', 20)"
>
Detail
</a>
...
...
@@ -1292,11 +1292,34 @@
<tr
id=
'pt13.2'
class=
'hiddenRow bg-success'
>
<tr
id=
"ft13.2"
class=
"none bg-danger"
>
<td>
<div
class=
'testcase'
>
TestEditBooksOnGdrive - test_edit_author
</div>
</td>
<td
colspan=
'6'
align=
'center'
>
PASS
</td>
<td
colspan=
'6'
>
<div
class=
"text-center"
>
<a
class=
"popup_link text-center"
onfocus=
'blur()'
onclick=
"showTestDetail('div_ft13.2')"
>
FAIL
</a>
</div>
<!--css div popup start-->
<div
id=
"div_ft13.2"
class=
"popup_window test_output"
style=
"display:block;"
>
<div
class=
'close_button pull-right'
>
<button
type=
"button"
class=
"close"
aria-label=
"Close"
onfocus=
'this.blur();'
onclick=
'document.getElementById('
div_ft13
.
2
').
style
.
display=
'none'
"
><span
aria-hidden=
"true"
>
×
</span></button>
</div>
<div
class=
"text-left pull-left"
>
<pre
class=
"text-left"
>
Traceback (most recent call last):
File "/home/ozzie/Development/calibre-web-test/test/test_edit_ebooks_gdrive.py", line 354, in test_edit_author
self.assertEqual(u'Sigurd Lindgren
&
Leo Baskerville', author.get_attribute('value'))
AssertionError: 'Sigurd Lindgren
&
Leo Baskerville' != 'Sigurd Lindgren
&
Leo Baskerville'
- Sigurd Lindgren
&
Leo Baskerville
? - -
+ Sigurd Lindgren
&
Leo Baskerville
</pre>
</div>
<div
class=
"clearfix"
></div>
</div>
<!--css div popup end-->
</td>
</tr>
...
...
@@ -1418,11 +1441,31 @@
<tr
id=
'pt13.16'
class=
'hiddenRow bg-success'
>
<tr
id=
"et13.16"
class=
"none bg-info"
>
<td>
<div
class=
'testcase'
>
TestEditBooksOnGdrive - test_edit_title
</div>
</td>
<td
colspan=
'6'
align=
'center'
>
PASS
</td>
<td
colspan=
'6'
>
<div
class=
"text-center"
>
<a
class=
"popup_link text-center"
onfocus=
'blur()'
onclick=
"showTestDetail('div_et13.16')"
>
ERROR
</a>
</div>
<!--css div popup start-->
<div
id=
"div_et13.16"
class=
"popup_window test_output"
style=
"display:block;"
>
<div
class=
'close_button pull-right'
>
<button
type=
"button"
class=
"close"
aria-label=
"Close"
onfocus=
'this.blur();'
onclick=
'document.getElementById('
div_et13
.
16
').
style
.
display=
'none'
"
><span
aria-hidden=
"true"
>
×
</span></button>
</div>
<div
class=
"text-left pull-left"
>
<pre
class=
"text-left"
>
Traceback (most recent call last):
File "/home/ozzie/Development/calibre-web-test/test/test_edit_ebooks_gdrive.py", line 240, in test_edit_title
self.assertEqual(ele.text, u'Very long extra super turbo cool title without any issue of displaying including ö utf-8 characters')
AttributeError: 'bool' object has no attribute 'text'
</pre>
</div>
<div
class=
"clearfix"
></div>
</div>
<!--css div popup end-->
</td>
</tr>
...
...
@@ -2850,13 +2893,13 @@
<tr
id=
"su"
class=
"
fail
Class"
>
<tr
id=
"su"
class=
"
pass
Class"
>
<td>
TestUserList
</td>
<td
class=
"text-center"
>
16
</td>
<td
class=
"text-center"
>
13
</td>
<td
class=
"text-center"
>
2
</td>
<td
class=
"text-center"
>
16
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
1
</td>
<td
class=
"text-center"
>
<a
onclick=
"showClassDetail('c31', 16)"
>
Detail
</a>
</td>
...
...
@@ -2891,28 +2934,11 @@
<tr
id=
"st31.4"
class=
"none bg-warning"
>
<tr
id=
'pt31.4'
class=
'hiddenRow bg-success'
>
<td>
<div
class=
'testcase'
>
TestUserList - test_user_list_denied_tags
</div>
</td>
<td
colspan=
'6'
>
<div
class=
"text-center"
>
<a
class=
"popup_link text-center"
onfocus=
'blur()'
onclick=
"showTestDetail('div_st31.4')"
>
SKIP
</a>
</div>
<!--css div popup start-->
<div
id=
"div_st31.4"
class=
"popup_window test_output"
style=
"display:none;"
>
<div
class=
'close_button pull-right'
>
<button
type=
"button"
class=
"close"
aria-label=
"Close"
onfocus=
'this.blur();'
onclick=
'document.getElementById('
div_st31
.
4
').
style
.
display=
'none'
"
><span
aria-hidden=
"true"
>
×
</span></button>
</div>
<div
class=
"text-left pull-left"
>
<pre
class=
"text-left"
>
Not Implemented
</pre>
</div>
<div
class=
"clearfix"
></div>
</div>
<!--css div popup end-->
</td>
<td
colspan=
'6'
align=
'center'
>
PASS
</td>
</tr>
...
...
@@ -2989,31 +3015,11 @@
<tr
id=
"ft31.13"
class=
"none bg-danger"
>
<tr
id=
'pt31.13'
class=
'hiddenRow bg-success'
>
<td>
<div
class=
'testcase'
>
TestUserList - test_user_list_guest_edit
</div>
</td>
<td
colspan=
'6'
>
<div
class=
"text-center"
>
<a
class=
"popup_link text-center"
onfocus=
'blur()'
onclick=
"showTestDetail('div_ft31.13')"
>
FAIL
</a>
</div>
<!--css div popup start-->
<div
id=
"div_ft31.13"
class=
"popup_window test_output"
style=
"display:block;"
>
<div
class=
'close_button pull-right'
>
<button
type=
"button"
class=
"close"
aria-label=
"Close"
onfocus=
'this.blur();'
onclick=
'document.getElementById('
div_ft31
.
13
').
style
.
display=
'none'
"
><span
aria-hidden=
"true"
>
×
</span></button>
</div>
<div
class=
"text-left pull-left"
>
<pre
class=
"text-left"
>
Traceback (most recent call last):
File "/home/ozzie/Development/calibre-web-test/test/test_user_list.py", line 488, in test_user_list_guest_edit
self.assertTrue(self.check_element_on_page((By.ID, 'flash_danger')))
AssertionError: False is not true
</pre>
</div>
<div
class=
"clearfix"
></div>
</div>
<!--css div popup end-->
</td>
<td
colspan=
'6'
align=
'center'
>
PASS
</td>
</tr>
...
...
@@ -3036,33 +3042,11 @@ AssertionError: False is not true</pre>
<tr
id=
"ft31.16"
class=
"none bg-danger"
>
<tr
id=
'pt31.16'
class=
'hiddenRow bg-success'
>
<td>
<div
class=
'testcase'
>
TestUserList - test_user_list_sort
</div>
</td>
<td
colspan=
'6'
>
<div
class=
"text-center"
>
<a
class=
"popup_link text-center"
onfocus=
'blur()'
onclick=
"showTestDetail('div_ft31.16')"
>
FAIL
</a>
</div>
<!--css div popup start-->
<div
id=
"div_ft31.16"
class=
"popup_window test_output"
style=
"display:block;"
>
<div
class=
'close_button pull-right'
>
<button
type=
"button"
class=
"close"
aria-label=
"Close"
onfocus=
'this.blur();'
onclick=
'document.getElementById('
div_ft31
.
16
').
style
.
display=
'none'
"
><span
aria-hidden=
"true"
>
×
</span></button>
</div>
<div
class=
"text-left pull-left"
>
<pre
class=
"text-left"
>
Traceback (most recent call last):
File "/home/ozzie/Development/calibre-web-test/test/test_user_list.py", line 452, in test_user_list_sort
self.assertEqual("muki9al@b.com", ul['table'][0]['E-mail Address']['text'])
AssertionError: 'muki9al@b.com' != 'no@email'
- muki9al@b.com
+ no@email
</pre>
</div>
<div
class=
"clearfix"
></div>
</div>
<!--css div popup end-->
</td>
<td
colspan=
'6'
align=
'center'
>
PASS
</td>
</tr>
...
...
@@ -3769,10 +3753,10 @@ AssertionError: 'muki9al@b.com' != 'no@email'
<tr
id=
'total_row'
class=
"text-center bg-grey"
>
<td>
Total
</td>
<td>
331
</td>
<td>
32
2
</td>
<td>
2
</td>
<td>
0
</td>
<td>
7
</td>
<td>
32
3
</td>
<td>
1
</td>
<td>
1
</td>
<td>
6
</td>
<td>
</td>
</tr>
</table>
...
...
@@ -4178,7 +4162,7 @@ AssertionError: 'muki9al@b.com' != 'no@email'
</div>
<script>
drawCircle
(
32
2
,
2
,
0
,
7
);
drawCircle
(
32
3
,
1
,
1
,
6
);
showCase
(
5
);
</script>
...
...
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