Skip to content

Commit

Permalink
Merge pull request #872 from datacite/fabrica-improvements-10
Browse files Browse the repository at this point in the history
Changes to support Fabrica Improvements feature 10
  • Loading branch information
codycooperross authored Oct 31, 2022
2 parents 6a09c56 + 256d32e commit d8a25a1
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/models/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class Provider < ApplicationRecord
professionalSociety
publisher
serviceProvider
internationalOrganization
other
],
message:
Expand Down
1 change: 1 addition & 0 deletions app/serializers/repository_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class RepositorySerializer
:domains,
:issn,
:url,
:software,
:salesforce_id,
:from_salesforce,
:created,
Expand Down
8 changes: 4 additions & 4 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,11 @@ paths:
- invenio
- islandora
- nesstar
- open_journal_systems_ojs
- open journal systems (ojs)
- opus
- samvera
- pubman
- mycore
- other
- unknown
- in: query
Expand Down Expand Up @@ -883,15 +885,13 @@ paths:
type: string
enum:
- academicInstitution
- academicLibrary
- governmentAgency
- nationalInstitution
- nationalLibrary
- publisher
- professionalSociety
- researchInstitution
- serviceProvider
- vendor
- internationalOrganization
- other
- in: query
name: focus-area
Expand Down
46 changes: 46 additions & 0 deletions spec/requests/providers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,48 @@
end
end

context "create provider with internationalOrganization organization type" do
provider_symbol = "FG"
let(:params) do
{
"data" => {
"type" => "providers",
"attributes" => {
"symbol" => provider_symbol,
"name" => "Figshare",
"displayName" => "Figshare",
"region" => "EMEA",
"systemEmail" => "[email protected]",
"website" => "https://www.bl.uk",
"memberType" => "direct_member",
"organizationType" => "internationalOrganization",
"country" => "GB",
},
},
}
end

it "creates a provider" do
post "/providers", params, admin_headers

expect(last_response.status).to eq(200)
expect(json.dig("data", "attributes", "organizationType")).to eq(
"internationalOrganization",
)

sleep 1

get "/providers/#{
provider_symbol
}",
nil, headers

expect(json.dig("data", "attributes", "organizationType")).to eq(
"internationalOrganization",
)
end
end

context "when the request is missing a required attribute" do
let(:params) do
{
Expand Down Expand Up @@ -937,6 +979,7 @@
"globusUuid" => "9908a164-1e4f-4c17-ae1b-cc318839d6c8",
"displayName" => "British Library",
"memberType" => "consortium_organization",
"organizationType" => "internationalOrganization",
"website" => "https://www.bl.uk",
"region" => "Americas",
"systemEmail" => "[email protected]",
Expand Down Expand Up @@ -966,6 +1009,9 @@
expect(
json.dig("data", "relationships", "consortium", "data", "id"),
).to eq(consortium.symbol.downcase)
expect(json.dig("data", "attributes", "organizationType")).to eq(
"internationalOrganization",
)
end
end

Expand Down
7 changes: 7 additions & 0 deletions spec/requests/repositories_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"name" => "Imperial College",
"systemEmail" => "[email protected]",
"salesforceId" => "abc012345678901234",
"software" => "MyCoRe",
"fromSalesforce" => true,
"clientType" => "repository",
"certificate" => %w[CoreTrustSeal],
Expand Down Expand Up @@ -125,6 +126,7 @@
expect(json.dig("data", "attributes", "globusUuid")).to eq(
"bc7d0274-3472-4a79-b631-e4c7baccc667",
)
expect(json.dig("data", "attributes", "software")).to eq(client.software)
expect(json["meta"]).to eq("doiCount" => 0, "prefixCount" => 0)
end
end
Expand Down Expand Up @@ -240,6 +242,7 @@
expect(attributes["name"]).to eq("Imperial College")
expect(attributes["systemEmail"]).to eq("[email protected]")
expect(attributes["certificate"]).to eq(%w[CoreTrustSeal])
expect(attributes["software"]).to eq("MyCoRe")
expect(attributes["salesforceId"]).to eq("abc012345678901234")

relationships = json.dig("data", "relationships")
Expand Down Expand Up @@ -322,6 +325,7 @@
"name" => "Imperial College 2",
"clientType" => "periodical",
"globusUuid" => "9908a164-1e4f-4c17-ae1b-cc318839d6c8",
"software" => "OPUS"
},
},
}
Expand All @@ -337,6 +341,9 @@
expect(json.dig("data", "attributes", "globusUuid")).to eq(
"9908a164-1e4f-4c17-ae1b-cc318839d6c8",
)
expect(json.dig("data", "attributes", "software")).to eq(
"OPUS",
)
expect(json.dig("data", "attributes", "name")).not_to eq(client.name)
expect(json.dig("data", "attributes", "clientType")).to eq("periodical")
end
Expand Down

0 comments on commit d8a25a1

Please sign in to comment.