Skip to content

Commit

Permalink
add spec
Browse files Browse the repository at this point in the history
  • Loading branch information
viktorerlingsson committed Oct 26, 2023
1 parent 88ff2fb commit a05d6fe
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions spec/api/definitions_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,15 @@ describe LavinMQ::HTTP::Server do
Server.vhosts["uploaded_vhost"]?.should_not be_nil
Server.vhosts["uploaded_vhost"].should be_a(LavinMQ::VHost)
end

it "imports definitions from json body" do
body = {vhosts: [{name: "uploaded_vhost"}]}.to_json
headers = {"Content-Type" => "application/json"}
response = post("/api/definitions/upload", headers: headers, body: body)
response.status_code.should eq 200
Server.vhosts["uploaded_vhost"]?.should_not be_nil
Server.vhosts["uploaded_vhost"].should be_a(LavinMQ::VHost)
end
end

it "should update existing user on import" do
Expand Down

0 comments on commit a05d6fe

Please sign in to comment.