Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pleroma
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
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
kaniini
pleroma
Commits
c99b9b9d
Commit
c99b9b9d
authored
6 years ago
by
kaniini
Browse files
Options
Downloads
Patches
Plain Diff
testsuite: add mastodon api tests
parent
4084889a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/web/mastodon_api/mastodon_api_controller_test.exs
+58
-0
58 additions, 0 deletions
test/web/mastodon_api/mastodon_api_controller_test.exs
with
58 additions
and
0 deletions
test/web/mastodon_api/mastodon_api_controller_test.exs
+
58
−
0
View file @
c99b9b9d
...
...
@@ -4,6 +4,7 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
alias
Pleroma
.
Web
.
TwitterAPI
.
TwitterAPI
alias
Pleroma
.
{
Repo
,
User
,
Activity
,
Notification
}
alias
Pleroma
.
Web
.
{
OStatus
,
CommonAPI
}
alias
Pleroma
.
Web
.
ActivityPub
.
ActivityPub
import
Pleroma
.
Factory
import
ExUnit
.
CaptureLog
...
...
@@ -644,6 +645,63 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
end
end
describe
"locked accounts"
do
test
"/api/v1/follow_requests works"
do
user
=
insert
(
:user
,
%{
info:
%{
"locked"
=>
true
}})
other_user
=
insert
(
:user
)
{
:ok
,
activity
}
=
ActivityPub
.
follow
(
other_user
,
user
)
conn
=
build_conn
()
|>
assign
(
:user
,
user
)
|>
get
(
"/api/v1/follow_requests"
)
assert
[
relationship
]
=
json_response
(
conn
,
200
)
assert
to_string
(
other_user
.
id
)
==
relationship
[
"id"
]
end
test
"/api/v1/follow_requests/:id/authorize works"
do
user
=
insert
(
:user
,
%{
info:
%{
"locked"
=>
true
}})
other_user
=
insert
(
:user
)
{
:ok
,
activity
}
=
ActivityPub
.
follow
(
other_user
,
user
)
conn
=
build_conn
()
|>
assign
(
:user
,
user
)
|>
post
(
"/api/v1/follow_requests/
#{
other_user
.
id
}
/authorize"
)
assert
relationship
=
json_response
(
conn
,
200
)
assert
to_string
(
other_user
.
id
)
==
relationship
[
"id"
]
user
=
Repo
.
get
(
User
,
user
.
id
)
other_user
=
Repo
.
get
(
User
,
other_user
.
id
)
assert
User
.
following?
(
other_user
,
user
)
==
true
end
test
"/api/v1/follow_requests/:id/reject works"
do
user
=
insert
(
:user
,
%{
info:
%{
"locked"
=>
true
}})
other_user
=
insert
(
:user
)
{
:ok
,
activity
}
=
ActivityPub
.
follow
(
other_user
,
user
)
conn
=
build_conn
()
|>
assign
(
:user
,
user
)
|>
post
(
"/api/v1/follow_requests/
#{
other_user
.
id
}
/reject"
)
assert
relationship
=
json_response
(
conn
,
200
)
assert
to_string
(
other_user
.
id
)
==
relationship
[
"id"
]
user
=
Repo
.
get
(
User
,
user
.
id
)
other_user
=
Repo
.
get
(
User
,
other_user
.
id
)
assert
User
.
following?
(
other_user
,
user
)
==
false
end
end
test
"account fetching"
,
%{
conn:
conn
}
do
user
=
insert
(
:user
)
...
...
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