Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
network
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
9
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
funkwhale
network
Commits
f6fe7dc3
Unverified
Commit
f6fe7dc3
authored
4 years ago
by
Agate
💬
Browse files
Options
Downloads
Patches
Plain Diff
Support URL in form protocol
parent
1c10dccb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
funkwhale_network/routes.py
+1
-0
1 addition, 0 deletions
funkwhale_network/routes.py
tests/test_routes.py
+10
-0
10 additions, 0 deletions
tests/test_routes.py
with
11 additions
and
0 deletions
funkwhale_network/routes.py
+
1
−
0
View file @
f6fe7dc3
...
@@ -26,6 +26,7 @@ domain_filters = {
...
@@ -26,6 +26,7 @@ domain_filters = {
def
validate_domain
(
raw
):
def
validate_domain
(
raw
):
raw
=
raw
.
split
(
'
://
'
)[
-
1
]
if
not
raw
:
if
not
raw
:
raise
ValueError
()
raise
ValueError
()
...
...
This diff is collapsed.
Click to expand it.
tests/test_routes.py
+
10
−
0
View file @
f6fe7dc3
...
@@ -2,6 +2,7 @@ import datetime
...
@@ -2,6 +2,7 @@ import datetime
import
pytest
import
pytest
from
funkwhale_network
import
db
from
funkwhale_network
import
db
from
funkwhale_network
import
routes
from
funkwhale_network
import
serializers
from
funkwhale_network
import
serializers
...
@@ -129,3 +130,12 @@ async def test_domains_rss(db_conn, factories, client, mocker):
...
@@ -129,3 +130,12 @@ async def test_domains_rss(db_conn, factories, client, mocker):
assert
resp
.
status
==
200
assert
resp
.
status
==
200
assert
await
resp
.
text
()
==
expected
assert
await
resp
.
text
()
==
expected
assert
resp
.
headers
[
"
content-type
"
]
==
"
application/rss+xml
"
assert
resp
.
headers
[
"
content-type
"
]
==
"
application/rss+xml
"
@pytest.mark.parametrize
(
'
input,expected
'
,
[
(
'
example.com
'
,
'
example.com
'
),
(
'
http://example.com
'
,
'
example.com
'
),
(
'
https://example.com
'
,
'
example.com
'
),
])
def
test_validate_domain
(
input
,
expected
):
assert
routes
.
validate_domain
(
input
)
==
expected
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment