Update Enterprise request spec

Check all the attributes supported by the DFC connector
This commit is contained in:
Gaetan Craig-Riou
2023-08-14 15:52:08 +10:00
committed by Maikel Linke
parent 244b9abd21
commit f5fb760128
3 changed files with 21 additions and 8 deletions

View File

@@ -5,7 +5,12 @@ require DfcProvider::Engine.root.join("spec/swagger_helper")
describe "CatalogItems", type: :request, swagger_doc: "dfc-v1.7/swagger.yaml",
rswag_autodoc: true do
let(:user) { create(:oidc_user, id: 12_345) }
let(:enterprise) { create(:distributor_enterprise, id: 10_000, owner: user) }
let(:enterprise) {
create(
:distributor_enterprise,
id: 10_000, owner: user, name: "Fred's Farm", description: "Beautiful",
)
}
let(:product) {
create(
:base_product,

View File

@@ -4,7 +4,13 @@ require DfcProvider::Engine.root.join("spec/swagger_helper")
describe "Enterprises", type: :request, swagger_doc: "dfc-v1.7/swagger.yaml", rswag_autodoc: true do
let!(:user) { create(:oidc_user) }
let!(:enterprise) { create(:distributor_enterprise, id: 10_000, owner: user) }
let!(:enterprise) do
create(
:distributor_enterprise,
id: 10_000, owner: user, abn: "123 456", name: "Fred's Farm",
description: "This is an awesome enterprise",
)
end
let!(:product) {
create(
:base_product,
@@ -36,6 +42,9 @@ describe "Enterprises", type: :request, swagger_doc: "dfc-v1.7/swagger.yaml", rs
let(:id) { enterprise.id }
run_test! do
expect(response.body).to include "Fred's Farm"
expect(response.body).to include "This is an awesome enterprise"
expect(response.body).to include "123 456"
expect(response.body).to include "Apple"
end
end

View File

@@ -64,9 +64,8 @@ paths:
dfc-b:affiliates: http://test.host/api/dfc-v1.7/enterprises/10000
- "@id": http://test.host/api/dfc-v1.7/enterprises/10000
"@type": dfc-b:Enterprise
dfc-b:hasName: ''
dfc-b:hasDescription: ''
dfc-b:VATnumber: ''
dfc-b:hasName: Fred's Farm
dfc-b:hasDescription: Beautiful
dfc-b:supplies: http://test.host/api/dfc-v1.7/enterprises/10000/supplied_products/10001
dfc-b:manages: http://test.host/api/dfc-v1.7/enterprises/10000/catalog_items/10001
- "@id": http://test.host/api/dfc-v1.7/enterprises/10000/catalog_items/10001
@@ -221,9 +220,9 @@ paths:
"@graph":
- "@id": http://test.host/api/dfc-v1.7/enterprises/10000
"@type": dfc-b:Enterprise
dfc-b:hasName: ''
dfc-b:hasDescription: ''
dfc-b:VATnumber: ''
dfc-b:hasName: Fred's Farm
dfc-b:hasDescription: This is an awesome enterprise
dfc-b:VATnumber: 123 456
dfc-b:supplies: http://test.host/api/dfc-v1.7/enterprises/10000/supplied_products/10001
dfc-b:manages: http://test.host/api/dfc-v1.7/enterprises/10000/catalog_items/10001
- "@id": http://test.host/api/dfc-v1.7/enterprises/10000/supplied_products/10001