Commit ce1cc82a72aec9ec0121646d3b9c27137b95cc49
Committed by
Rodrigo Souto
1 parent
9c330a8c
Exists in
master
and in
29 other branches
adding tests for user endpoint
Showing
2 changed files
with
9 additions
and
2 deletions
Show diff stats
lib/api/v1/users.rb
test/unit/api/users_test.rb
... | ... | @@ -12,9 +12,16 @@ class UsersTest < ActiveSupport::TestCase |
12 | 12 | assert_includes json["users"].map { |a| a["login"] }, user.login |
13 | 13 | end |
14 | 14 | |
15 | + should 'get user' do | |
16 | + get "/api/v1/users/#{user.id}?#{params.to_query}" | |
17 | + json = JSON.parse(last_response.body) | |
18 | + assert_equal user.id, json['user']['id'] | |
19 | + end | |
20 | + | |
21 | + | |
15 | 22 | should 'list user permissions' do |
16 | 23 | community = fast_create(Community) |
17 | - community.add_admin(user.person) | |
24 | + community.add_admin(person) | |
18 | 25 | get "/api/v1/users/#{user.id}/?#{params.to_query}" |
19 | 26 | json = JSON.parse(last_response.body) |
20 | 27 | assert_includes json["user"]["permissions"], community.identifier | ... | ... |