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
7b789b37
Commit
7b789b37
authored
Apr 26, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix opds with shelves
Fix errorhandler ldap without ldap
parent
0480d493
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
129 additions
and
53 deletions
+129
-53
opds.py
cps/opds.py
+2
-2
web.py
cps/web.py
+6
-5
Calibre-Web TestSummary.html
test/Calibre-Web TestSummary.html
+121
-46
No files found.
cps/opds.py
View file @
7b789b37
...
...
@@ -344,12 +344,12 @@ def feed_shelf(book_id):
off
=
request
.
args
.
get
(
"offset"
)
or
0
if
current_user
.
is_anonymous
:
shelf
=
ub
.
session
.
query
(
ub
.
Shelf
)
.
filter
(
ub
.
Shelf
.
is_public
==
1
,
ub
.
Shelf
.
id
==
book_id
,
not
ub
.
Shelf
.
deleted
)
.
first
()
ub
.
Shelf
.
id
==
book_id
)
.
first
()
else
:
shelf
=
ub
.
session
.
query
(
ub
.
Shelf
)
.
filter
(
or_
(
and_
(
ub
.
Shelf
.
user_id
==
int
(
current_user
.
id
),
ub
.
Shelf
.
id
==
book_id
),
and_
(
ub
.
Shelf
.
is_public
==
1
,
ub
.
Shelf
.
id
==
book_id
))
,
not
ub
.
Shelf
.
deleted
)
.
first
()
ub
.
Shelf
.
id
==
book_id
)))
.
first
()
result
=
list
()
# user is allowed to access shelf
if
shelf
:
...
...
cps/web.py
View file @
7b789b37
...
...
@@ -112,9 +112,10 @@ for ex in default_exceptions:
app
.
register_error_handler
(
ex
,
internal_error
)
# Only way of catching the LDAPException upon logging in with LDAP server down
@
app
.
errorhandler
(
services
.
ldap
.
LDAPException
)
def
handle_exception
(
e
):
if
feature_support
[
'ldap'
]:
# Only way of catching the LDAPException upon logging in with LDAP server down
@
app
.
errorhandler
(
services
.
ldap
.
LDAPException
)
def
handle_exception
(
e
):
log
.
debug
(
'LDAP server not accessible while trying to login to opds feed'
)
return
error_http
(
FailedDependency
())
...
...
test/Calibre-Web TestSummary.html
View file @
7b789b37
...
...
@@ -36,17 +36,17 @@
<div
class=
"col-xs-12 col-sm-6"
>
<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>
2020-04-
18 10:46:25
</p>
<p
class=
'text-justify attribute'
><strong>
Start Time:
</strong>
2020-04-
25 21:22:13
</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>
2020-04-
18 11:34:5
4
</p>
<p
class=
'text-justify attribute'
><strong>
Stop Time:
</strong>
2020-04-
25 22:12:2
4
</p>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-xs-6 col-md-6 col-sm-offset-3"
>
<p
class=
'text-justify attribute'
><strong>
Duration:
</strong>
4
1:54
min
</p>
<p
class=
'text-justify attribute'
><strong>
Duration:
</strong>
4
2:25
min
</p>
</div>
</div>
</div>
...
...
@@ -975,53 +975,30 @@
<tr
class=
"result['header']['style']"
>
<td>
test_kobo_sync.test_kobo_sync
</td>
<td
class=
"text-center"
>
3
</td>
<td
class=
"text-center"
>
2
</td>
<td
class=
"text-center"
>
1
</td>
<td
class=
"text-center"
>
8
</td>
<td
class=
"text-center"
>
8
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
<a
onclick=
"showClassDetail('c8',
3
)"
>
Detail
</a>
<a
onclick=
"showClassDetail('c8',
8
)"
>
Detail
</a>
</td>
</tr>
<tr
id=
'
ft8.1'
class=
'none bg-danger
'
>
<tr
id=
'
pt8.1'
class=
'hiddenRow bg-success
'
>
<td>
<div
class=
'testcase'
>
test_check_sync
</div>
</td>
<td
colspan=
'6'
>
<div
class=
"text-center"
>
<a
class=
"popup_link text-center"
onfocus=
'blur()'
onclick=
"showTestDetail('div_ft8.1')"
>
FAIL
</a>
</div>
<!--css div popup start-->
<div
id=
'div_ft8.1'
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_ft8.1').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/matthias/Entwicklung/calibre-web-test/test/test_kobo_sync.py", line 89, in test_check_sync
self.assertEqual(r.json()['Resources']['image_url_quality_template'], self.kobo_adress+"/{ImageId}/{width}/{height}/image.jpg")
AssertionError: 'http[35 chars]65c2703d57c660b93b6ebdafa/{ImageId}/image.jpg' != 'http[35 chars]65c2703d57c660b93b6ebdafa/{ImageId}/{width}/{height}/image.jpg'
- http://192.168.188.33:8083/kobo/8e590a265c2703d57c660b93b6ebdafa/{ImageId}/image.jpg
+ http://192.168.188.33:8083/kobo/8e590a265c2703d57c660b93b6ebdafa/{ImageId}/{width}/{height}/image.jpg
? +++++++++++++++++
</pre>
</div>
<div
class=
"clearfix"
></div>
</div>
<!--css div popup end-->
<div
class=
'testcase'
>
test_kobo_about
</div>
</td>
<td
colspan=
'6'
align=
'center'
>
PASS
</td>
</tr>
<tr
id=
'pt8.2'
class=
'hiddenRow bg-success'
>
<td>
<div
class=
'testcase'
>
test_
kobo_about
</div>
<div
class=
'testcase'
>
test_
shelves_add_remove_books
</div>
</td>
<td
colspan=
'6'
align=
'center'
>
PASS
</td>
</tr>
...
...
@@ -1029,6 +1006,15 @@ AssertionError: 'http[35 chars]65c2703d57c660b93b6ebdafa/{ImageId}/image.jpg' !=
<tr
id=
'pt8.3'
class=
'hiddenRow bg-success'
>
<td>
<div
class=
'testcase'
>
test_sync_changed_book
</div>
</td>
<td
colspan=
'6'
align=
'center'
>
PASS
</td>
</tr>
<tr
id=
'pt8.4'
class=
'hiddenRow bg-success'
>
<td>
<div
class=
'testcase'
>
test_sync_invalid
</div>
</td>
...
...
@@ -1037,16 +1023,52 @@ AssertionError: 'http[35 chars]65c2703d57c660b93b6ebdafa/{ImageId}/image.jpg' !=
<tr
id=
'pt8.5'
class=
'hiddenRow bg-success'
>
<td>
<div
class=
'testcase'
>
test_sync_reading_state
</div>
</td>
<td
colspan=
'6'
align=
'center'
>
PASS
</td>
</tr>
<tr
id=
'pt8.6'
class=
'hiddenRow bg-success'
>
<td>
<div
class=
'testcase'
>
test_sync_shelf
</div>
</td>
<td
colspan=
'6'
align=
'center'
>
PASS
</td>
</tr>
<tr
id=
'pt8.7'
class=
'hiddenRow bg-success'
>
<td>
<div
class=
'testcase'
>
test_sync_unchanged
</div>
</td>
<td
colspan=
'6'
align=
'center'
>
PASS
</td>
</tr>
<tr
id=
'pt8.8'
class=
'hiddenRow bg-success'
>
<td>
<div
class=
'testcase'
>
test_sync_upload
</div>
</td>
<td
colspan=
'6'
align=
'center'
>
PASS
</td>
</tr>
<tr
class=
"result['header']['style']"
>
<td>
test_ldap.test_ldap_login
</td>
<td
class=
"text-center"
>
8
</td>
<td
class=
"text-center"
>
8
</td>
<td
class=
"text-center"
>
9
</td>
<td
class=
"text-center"
>
9
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
<a
onclick=
"showClassDetail('c9',
8
)"
>
Detail
</a>
<a
onclick=
"showClassDetail('c9',
9
)"
>
Detail
</a>
</td>
</tr>
...
...
@@ -1124,6 +1146,15 @@ AssertionError: 'http[35 chars]65c2703d57c660b93b6ebdafa/{ImageId}/image.jpg' !=
<tr
id=
'pt9.9'
class=
'hiddenRow bg-success'
>
<td>
<div
class=
'testcase'
>
test_ldap_opds_download_book
</div>
</td>
<td
colspan=
'6'
align=
'center'
>
PASS
</td>
</tr>
<tr
class=
"result['header']['style']"
>
<td>
test_logging.test_logging
</td>
...
...
@@ -1209,7 +1240,7 @@ AssertionError: 'http[35 chars]65c2703d57c660b93b6ebdafa/{ImageId}/image.jpg' !=
</div>
<div
class=
"text-left pull-left"
>
<pre
class=
"text-left"
>
Traceback (most recent call last):
File "/home/matthias/Entwicklung/calibre-web-test/test/test_logging.py", line 13
6
, in test_logfile_recover
File "/home/matthias/Entwicklung/calibre-web-test/test/test_logging.py", line 13
7
, in test_logfile_recover
self.assertTrue(logpath=="", "logfile config value is not empty after reseting to default")
AssertionError: False is not true : logfile config value is not empty after reseting to default
</pre>
</div>
...
...
@@ -1354,8 +1385,8 @@ AssertionError: False is not true : logfile config value is not empty after rese
<tr
class=
"result['header']['style']"
>
<td>
test_opds_feed.test_opds_feed
</td>
<td
class=
"text-center"
>
20
</td>
<td
class=
"text-center"
>
20
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
19
</td>
<td
class=
"text-center"
>
1
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
0
</td>
<td
class=
"text-center"
>
...
...
@@ -1509,11 +1540,31 @@ AssertionError: False is not true : logfile config value is not empty after rese
<tr
id=
'
pt13.17'
class=
'hiddenRow bg-success
'
>
<tr
id=
'
ft13.17'
class=
'none bg-danger
'
>
<td>
<div
class=
'testcase'
>
test_opds_shelf_access
</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.17')"
>
FAIL
</a>
</div>
<!--css div popup start-->
<div
id=
'div_ft13.17'
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_ft13.17').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/matthias/Entwicklung/calibre-web-test/test/test_opds_feed.py", line 511, in test_opds_shelf_access
self.assertEqual(200, r.status_code)
AssertionError: 200 != 500
</pre>
</div>
<div
class=
"clearfix"
></div>
</div>
<!--css div popup end-->
</td>
</tr>
...
...
@@ -2205,8 +2256,8 @@ AssertionError: False is not true : logfile config value is not empty after rese
<tr
id=
'total_row'
class=
"text-center bg-grey"
>
<td>
Total
</td>
<td>
1
86
</td>
<td>
1
77
</td>
<td>
1
92
</td>
<td>
1
83
</td>
<td>
2
</td>
<td>
0
</td>
<td>
7
</td>
...
...
@@ -2253,6 +2304,12 @@ AssertionError: False is not true : logfile config value is not empty after rese
<td>
Basic
</td>
</tr>
<tr>
<th>
backports-abc
</th>
<td>
0.5
</td>
<td>
Basic
</td>
</tr>
<tr>
<th>
Flask
</th>
<td>
1.1.2
</td>
...
...
@@ -2283,6 +2340,12 @@ AssertionError: False is not true : logfile config value is not empty after rese
<td>
Basic
</td>
</tr>
<tr>
<th>
Jinja2
</th>
<td>
2.11.2
</td>
<td>
Basic
</td>
</tr>
<tr>
<th>
PyPDF2
</th>
<td>
1.26.0
</td>
...
...
@@ -2325,12 +2388,24 @@ AssertionError: False is not true : logfile config value is not empty after rese
<td>
Basic
</td>
</tr>
<tr>
<th>
Unidecode
</th>
<td>
1.1.1
</td>
<td>
Basic
</td>
</tr>
<tr>
<th>
Wand
</th>
<td>
0.5.9
</td>
<td>
Basic
</td>
</tr>
<tr>
<th>
Werkzeug
</th>
<td>
1.0.1
</td>
<td>
Basic
</td>
</tr>
<tr>
<th>
lxml
</th>
<td>
4.5.0
</td>
...
...
@@ -2339,7 +2414,7 @@ AssertionError: False is not true : logfile config value is not empty after rese
<tr>
<th>
Pillow
</th>
<td>
7.1.
1
</td>
<td>
7.1.
2
</td>
<td>
test_edit_books
</td>
</tr>
...
...
@@ -2381,7 +2456,7 @@ AssertionError: False is not true : logfile config value is not empty after rese
</div>
<script>
drawCircle
(
1
77
,
2
,
0
,
7
);
drawCircle
(
1
83
,
2
,
0
,
7
);
</script>
</div>
...
...
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