-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1185 from datacite/raid-registry
Implements raidRegistry client_type for Client
- Loading branch information
Showing
6 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,6 +126,26 @@ | |
} | ||
end | ||
|
||
let(:raid_registry_client_id) { provider.symbol + ".RAID" } | ||
let(:params_raid_registry) do | ||
{ | ||
"data" => { | ||
"type" => "clients", | ||
"attributes" => { | ||
"symbol" => raid_registry_client_id, | ||
"name" => "Imperial College", | ||
"contactEmail" => "[email protected]", | ||
"clientType" => "raidRegistry", | ||
}, | ||
"relationships": { | ||
"provider": { | ||
"data": { "type": "providers", "id": provider.uid }, | ||
}, | ||
}, | ||
}, | ||
} | ||
end | ||
|
||
it "creates a client" do | ||
post "/clients", params, headers | ||
|
||
|
@@ -168,6 +188,26 @@ | |
{ "count" => 1, "id" => "igsnCatalog", "title" => "IGSN ID Catalog" }, | ||
) | ||
end | ||
|
||
it "creates a client with raidRegistry client_type" do | ||
post "/clients", params_raid_registry, headers | ||
|
||
expect(last_response.status).to eq(201) | ||
attributes = json.dig("data", "attributes") | ||
expect(attributes["clientType"]).to eq("raidRegistry") | ||
|
||
Client.import | ||
sleep 2 | ||
|
||
get "/clients", nil, headers | ||
|
||
expect(json["data"].size).to eq(2) | ||
raid_registry_client = json.dig("data").find { |client| client.dig("attributes", "clientType") == "raidRegistry" } | ||
expect(raid_registry_client.dig("attributes", "symbol")).to eq(raid_registry_client_id) | ||
expect(json.dig("meta", "clientTypes").find { |clientTypeAgg| clientTypeAgg["id"] == "raidRegistry" }).to eq( | ||
{ "count" => 1, "id" => "raidRegistry", "title" => "RAiD Registry" }, | ||
) | ||
end | ||
end | ||
|
||
context "when the request is invalid" do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters