Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
funkwhale.audio
Manage
Activity
Members
Labels
Plan
Issues
8
Issue boards
Milestones
Wiki
Code
Merge requests
8
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
funkwhale.audio
Commits
871f6f49
Verified
Commit
871f6f49
authored
5 years ago
by
Eliot Berriot
Browse files
Options
Downloads
Patches
Plain Diff
Added basic NS tests
parent
e40ff9c4
No related branches found
No related tags found
1 merge request
!20
Added basic NS tests
Pipeline
#9905
passed with stages
in 2 minutes and 12 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+19
-0
19 additions, 0 deletions
.gitlab-ci.yml
public/ns
+1
-1
1 addition, 1 deletion
public/ns
test_ns.py
+79
-0
79 additions, 0 deletions
test_ns.py
with
99 additions
and
1 deletion
.gitlab-ci.yml
+
19
−
0
View file @
871f6f49
stages
:
-
test
-
review
-
build
variables
:
PIP_CACHE_DIR
:
"
$CI_PROJECT_DIR/pip-cache"
test_jsonld_ns
:
stage
:
test
image
:
python:3
interruptible
:
true
cache
:
key
:
"
$CI_PROJECT_ID__pip_cache"
paths
:
-
"
$PIP_CACHE_DIR"
before_script
:
-
pip install pyld pytest requests requests_mock
script
:
-
pytest test_ns.py
review
:
stage
:
review
image
:
buildkite/puppeteer
interruptible
:
true
variables
:
GIT_STRATEGY
:
clone
VUE_APP_ROUTER_BASE_URL
:
/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/review/
...
...
This diff is collapsed.
Click to expand it.
public/ns
+
1
−
1
View file @
871f6f49
...
...
@@ -55,6 +55,6 @@
"@id": "fw:license",
"@type": "@id"
},
"copyright": "fw:copyright"
,
"copyright": "fw:copyright"
}
}
This diff is collapsed.
Click to expand it.
test_ns.py
0 → 100644
+
79
−
0
View file @
871f6f49
import
pyld
import
json
import
os
import
requests_mock
PATH
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
"
public
"
,
"
ns
"
)
def
test_ns_is_valid_json
():
with
open
(
PATH
)
as
f
:
content
=
f
.
read
()
json
.
loads
(
content
)
def
test_fw_activity_using_schema
():
with
open
(
PATH
)
as
f
:
schema
=
f
.
read
()
jsonld_payload
=
"""
{
"
type
"
:
"
Album
"
,
"
id
"
:
"
https://channels.tests.funkwhale.audio/federation/music/albums/56439007-9f14-4f39-adbf-2108a6d2f494
"
,
"
name
"
:
"
Hobbykoch Podcast
"
,
"
published
"
:
"
2020-02-19T08:00:53.525566+00:00
"
,
"
musicbrainzId
"
: null,
"
released
"
:
"
2020-01-01
"
,
"
artists
"
: [
{
"
type
"
:
"
Artist
"
,
"
id
"
:
"
https://channels.tests.funkwhale.audio/federation/music/artists/bc187046-ab46-4e16-a41f-770e663dc285
"
,
"
name
"
:
"
Kai Daniel Du
"
,
"
published
"
:
"
2020-02-19T08:00:53.521010+00:00
"
,
"
musicbrainzId
"
: null,
"
attributedTo
"
:
"
https://channels.tests.funkwhale.audio/federation/actors/Testacc242
"
,
"
tag
"
: [
{
"
type
"
:
"
Hashtag
"
,
"
name
"
:
"
#Podcast
"
}
],
"
image
"
: null
}
],
"
attributedTo
"
:
"
https://channels.tests.funkwhale.audio/federation/actors/Testacc242
"
,
"
tag
"
: [
{
"
type
"
:
"
Hashtag
"
,
"
name
"
:
"
#Podcast
"
}
],
"
cover
"
: {
"
type
"
:
"
Link
"
,
"
href
"
:
"
https://channels.tests.funkwhale.audio/media/attachments/d7/e1/84/attachment_cover-56439007-9f14-4f39-adbf-2108a6d2f494.jpg
"
,
"
mediaType
"
:
"
image/jpeg
"
},
"
image
"
: {
"
type
"
:
"
Image
"
,
"
url
"
:
"
https://channels.tests.funkwhale.audio/media/attachments/d7/e1/84/attachment_cover-56439007-9f14-4f39-adbf-2108a6d2f494.jpg
"
,
"
mediaType
"
:
"
image/jpeg
"
},
"
@context
"
: [
"
https://www.w3.org/ns/activitystreams
"
,
"
https://w3id.org/security/v1
"
,
"
https://funkwhale.audio/ns
"
,
{
"
manuallyApprovesFollowers
"
:
"
as:manuallyApprovesFollowers
"
,
"
Hashtag
"
:
"
as:Hashtag
"
}
]
}
"""
parsed
=
json
.
loads
(
jsonld_payload
)
with
requests_mock
.
Mocker
(
real_http
=
True
)
as
m
:
m
.
get
(
"
https://funkwhale.audio/ns
"
,
text
=
schema
)
expanded
=
pyld
.
jsonld
.
expand
(
parsed
)
serialized
=
json
.
dumps
(
expanded
,
indent
=
2
)
assert
"
_:
"
not
in
serialized
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