Skip to content

Commit

Permalink
add extra users test
Browse files Browse the repository at this point in the history
  • Loading branch information
GrantBirki committed Jan 9, 2024
1 parent 6593356 commit 2dfbe95
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion spec/acceptance/tests/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require_relative "../../spec_helper"

describe "API call to users endpoint" do
it "returns valid data" do
it "returns valid data for all users" do
uri = URI("http://localhost:8080/v1/users")
response = Net::HTTP.get(uri)
users = JSON.parse(response)
Expand Down Expand Up @@ -42,4 +42,30 @@

expect(users).to eq(expected_users)
end

it "returns valid data for a single user" do
uri = URI("http://localhost:8080/v1/users/russianblue")
response = Net::HTTP.get(uri)
user = JSON.parse(response)

expected_user = {
"uid" => "russianblue",
"uidnumber" => 20_257
}

expect(user).to eq(expected_user)
end

it "returns valid data for a single user's group memberships" do
uri = URI("http://localhost:8080/v1/users/russianblue/groups")
response = Net::HTTP.get(uri)
user = JSON.parse(response)

expected_response = [
{ "name" => "colonel-meow" },
{ "name" => "garfield" }
]

expect(user).to eq(expected_response)
end
end

0 comments on commit 2dfbe95

Please sign in to comment.