Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
22830c8f
Commit
22830c8f
authored
Dec 06, 2018
by
Ivan Tashkinov
Browse files
[#394] Formatting fix.
parent
7b194873
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/web/admin_api/admin_api_controller_test.exs
View file @
22830c8f
...
...
@@ -48,12 +48,20 @@ test "Create" do
build_conn
()
|>
assign
(
:user
,
admin
)
|>
put_req_header
(
"accept"
,
"application/json"
)
|>
put
(
"/api/pleroma/admin/users/tag?nicknames[]=
#{
user1
.
nickname
}
&nicknames[]=
#{
user2
.
nickname
}
&tags[]=foo&tags[]=bar"
)
|>
put
(
"/api/pleroma/admin/users/tag?nicknames[]=
#{
user1
.
nickname
}
&nicknames[]=
#{
user2
.
nickname
}
&tags[]=foo&tags[]=bar"
)
%{
conn:
conn
,
user1:
user1
,
user2:
user2
,
user3:
user3
}
end
test
"it appends specified tags to users with specified nicknames"
,
%{
conn:
conn
,
user1:
user1
,
user2:
user2
}
do
test
"it appends specified tags to users with specified nicknames"
,
%{
conn:
conn
,
user1:
user1
,
user2:
user2
}
do
assert
json_response
(
conn
,
:no_content
)
assert
Repo
.
get
(
User
,
user1
.
id
)
.
tags
==
[
"x"
,
"foo"
,
"bar"
]
assert
Repo
.
get
(
User
,
user2
.
id
)
.
tags
==
[
"y"
,
"foo"
,
"bar"
]
...
...
@@ -76,12 +84,20 @@ test "it does not modify tags of not specified users", %{conn: conn, user3: user
build_conn
()
|>
assign
(
:user
,
admin
)
|>
put_req_header
(
"accept"
,
"application/json"
)
|>
put
(
"/api/pleroma/admin/users/untag?nicknames[]=
#{
user1
.
nickname
}
&nicknames[]=
#{
user2
.
nickname
}
&tags[]=x&tags[]=z"
)
|>
put
(
"/api/pleroma/admin/users/untag?nicknames[]=
#{
user1
.
nickname
}
&nicknames[]=
#{
user2
.
nickname
}
&tags[]=x&tags[]=z"
)
%{
conn:
conn
,
user1:
user1
,
user2:
user2
,
user3:
user3
}
end
test
"it removes specified tags from users with specified nicknames"
,
%{
conn:
conn
,
user1:
user1
,
user2:
user2
}
do
test
"it removes specified tags from users with specified nicknames"
,
%{
conn:
conn
,
user1:
user1
,
user2:
user2
}
do
assert
json_response
(
conn
,
:no_content
)
assert
Repo
.
get
(
User
,
user1
.
id
)
.
tags
==
[]
assert
Repo
.
get
(
User
,
user2
.
id
)
.
tags
==
[
"y"
]
...
...
Write
Preview
Supports
Markdown
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