Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add bruno int test collection #546

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
meta {
name: Add New Site to Supplier Partner
type: http
seq: 6
}

put {
url: {{CUSTOMER_PURIS_BACKEND}}/catena/partners/putSite?partnerBpnl={{SUPPLIER_BPNL}}
body: json
auth: none
}

params:query {
partnerBpnl: {{SUPPLIER_BPNL}}
}

headers {
Content-Type: application/json
X-Api-Key: {{CUSTOMER_PURIS_BACKEND_API_KEY}}
}

body:json {
{
"bpns": "{{SUPPLIER_BPNS2}}",
"name": "Semiconductor Supplier Inc. Secondary Site",
"addresses": [
{
"bpna": "{{SUPPLIER_BPNA2}}",
"streetAndNumber": "Sunset Blvd. 345",
"zipCodeAndCity": "90001 Los Angeles",
"country": "USA"
}
]
}
}

tests {
test("response is ok", function() {
expect(res.getStatus()).to.equal(200);
})

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
meta {
name: Create Control Unit Product
type: http
seq: 2
}

post {
url: {{CUSTOMER_PURIS_BACKEND}}/catena/materials
body: json
auth: none
}

headers {
Content-Type: application/json
X-Api-Key: {{CUSTOMER_PURIS_BACKEND_API_KEY}}
}

body:json {
{
"materialFlag": false,
"productFlag": true,
"ownMaterialNumber": "MNR-4177-S",
"materialNumberCx": null,
"name": "Central Control Unit"
}
}

tests {
test("response is ok", function() {
expect(res.getStatus()).to.equal(200);
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
meta {
name: Create Material Partner Relation
type: http
seq: 8
}

post {
url: {{CUSTOMER_PURIS_BACKEND}}/catena/materialpartnerrelations?partnerBpnl={{SUPPLIER_BPNL}}&ownMaterialNumber={{B64_MNR_CUSTOMER}}&partnerMaterialNumber={{B64_MNR_SUPPLIER}}&partnerSupplies=true&partnerBuys=false
body: none
auth: none
}

params:query {
partnerBpnl: {{SUPPLIER_BPNL}}
ownMaterialNumber: {{B64_MNR_CUSTOMER}}
partnerMaterialNumber: {{B64_MNR_SUPPLIER}}
partnerSupplies: true
partnerBuys: false
}

headers {
X-Api-Key: {{CUSTOMER_PURIS_BACKEND_API_KEY}}
}

script:pre-request {
var plain = bru.getEnvVar("MATERIAL_NUMBER_CUSTOMER")
var encoded = Buffer.from(plain).toString("base64")
bru.setVar("B64_MNR_CUSTOMER", encoded)
var plain = bru.getEnvVar("MATERIAL_NUMBER_SUPPLIER")
var encoded = Buffer.from(plain).toString("base64")
bru.setVar("B64_MNR_SUPPLIER", encoded)
}

tests {
test("response is ok", function() {
expect(res.getStatus()).to.equal(200);
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
meta {
name: Create Semiconductor Material
type: http
seq: 1
}

post {
url: {{CUSTOMER_PURIS_BACKEND}}/catena/materials
body: json
auth: none
}

headers {
Content-Type: application/json
X-Api-Key: {{CUSTOMER_PURIS_BACKEND_API_KEY}}
}

body:json {
{
"materialFlag": true,
"productFlag": false,
"ownMaterialNumber": "{{MATERIAL_NUMBER_CUSTOMER}}",
"materialNumberCx": "{{MATERIAL_NUMBER_CX}}",
"name": "Semiconductor"
}
}

tests {
test("response is ok", function() {
expect(res.getStatus()).to.equal(200);
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
meta {
name: Get All Materials
type: http
seq: 3
}

get {
url: {{CUSTOMER_PURIS_BACKEND}}/catena/materials/all
body: none
auth: none
}

headers {
X-Api-Key: {{CUSTOMER_PURIS_BACKEND_API_KEY}}
}

tests {
test("response is ok", function() {
expect(res.getStatus()).to.equal(200);
})

test("Verify response contains two objects", function () {
expect(res.getBody()).to.be.an("array").with.lengthOf(2);
});

test("Verify ownMaterialNumber values", function () {
const responseJson = res.getBody();

const foundValues = [];

responseJson.forEach(function (obj) {
expect(obj).to.have.property("ownMaterialNumber");
expect(obj.ownMaterialNumber).to.be.oneOf(["MNR-4177-S", bru.getEnvVar("MATERIAL_NUMBER_CUSTOMER")]);

// Put found value into foundValues to ensure that each value is only found once
expect(foundValues).to.not.include(obj.ownMaterialNumber);
foundValues.push(obj.ownMaterialNumber);
});
});

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
meta {
name: Get All Partners
type: http
seq: 7
}

get {
url: {{CUSTOMER_PURIS_BACKEND}}/catena/partners/all
body: none
auth: none
}

headers {
X-Api-Key: {{CUSTOMER_PURIS_BACKEND_API_KEY}}
}

tests {
test("response is ok", function() {
expect(res.getStatus()).to.equal(200);
})

test("Verify response contains two objects (puris owner, supplier partner)", function () {
expect(res.getBody()).to.be.an("array").with.lengthOf(2);
});

test("Verify supplier partner values (BPNL with one BPNS with one BPNA)", function () {
const responseJson = res.getBody();

const supplierPartner = responseJson.find(function (partner) {
return partner.bpnl === bru.getEnvVar("SUPPLIER_BPNL");
});

expect(supplierPartner).to.have.property("bpnl");

expect(supplierPartner.bpnl).to.equal(bru.getEnvVar("SUPPLIER_BPNL"));

expect(supplierPartner.sites).to.be.an("array").with.lengthOf(2);

// check only the newly added site as the other one has been checked earlier
const site = supplierPartner.sites.find(function (site) {
return site.bpns === bru.getEnvVar("SUPPLIER_BPNS2");
});

expect(site.addresses).to.be.an("array").with.lengthOf(1);

const address = site.addresses[0];
expect(address).to.have.property("bpna", bru.getEnvVar("SUPPLIER_BPNA2"));
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
meta {
name: Get Material Partner Mappings
type: http
seq: 9
}

get {
url: {{CUSTOMER_PURIS_BACKEND}}/catena/stockView/materialnumbers-mapping?ownMaterialNumber={{B64_MNR_CUSTOMER}}
body: none
auth: none
}

params:query {
ownMaterialNumber: {{B64_MNR_CUSTOMER}}
}

headers {
X-Api-Key: {{CUSTOMER_PURIS_BACKEND_API_KEY}}
}

tests {
test("response is ok", function() {
expect(res.getStatus()).to.equal(200);
})

test("Customer Mapping ok", function() {
const customerBPNL = bru.getEnvVar("CUSTOMER_BPNL");
const customerMatNbr = bru.getEnvVar("MATERIAL_NUMBER_CUSTOMER");
expect(res.getBody()[customerBPNL]).to.equal(customerMatNbr);
})

test("Supplier Mapping ok", function() {
const supplierBPNL = bru.getEnvVar("SUPPLIER_BPNL");
const supplierMatNbr = bru.getEnvVar("MATERIAL_NUMBER_SUPPLIER");
expect(res.getBody()[supplierBPNL]).to.equal(supplierMatNbr);
})


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
meta {
name: Get Own Sites
type: http
seq: 10
}

get {
url: {{CUSTOMER_PURIS_BACKEND}}/catena/partners/ownSites
body: none
auth: none
}

headers {
X-Api-Key: {{CUSTOMER_PURIS_BACKEND_API_KEY}}
}

tests {
test("response is ok", function() {
expect(res.getStatus()).to.equal(200);
})

test("Verify own site values (one BPNS with one BPNA)", function () {
const responseJson = res.getBody();

expect(responseJson).to.be.an("array").with.lengthOf(1);

const site = responseJson.find(function (site) {
return site.bpns === bru.getEnvVar("CUSTOMER_BPNS");
});

expect(site.addresses).to.be.an("array").with.lengthOf(1);

const address = site.addresses[0];
expect(address).to.have.property("bpna", bru.getEnvVar("CUSTOMER_BPNA"));
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
meta {
name: Get Supplier Partner
type: http
seq: 5
}

get {
url: {{CUSTOMER_PURIS_BACKEND}}/catena/partners?partnerBpnl={{SUPPLIER_BPNL}}
body: none
auth: none
}

params:query {
partnerBpnl: {{SUPPLIER_BPNL}}
}

headers {
X-Api-Key: {{CUSTOMER_PURIS_BACKEND_API_KEY}}
}

tests {
test("response is ok", function () {
expect(res.getStatus()).to.equal(200);
})

test("Verify partner values (BPNL with one BPNS with one BPNA)", function () {
const responseJson = res.getBody();

expect(responseJson).to.have.property("bpnl");
expect(responseJson.bpnl).to.equal(bru.getEnvVar("SUPPLIER_BPNL"));

expect(responseJson.sites).to.be.an("array").with.lengthOf(1);

const site = responseJson.sites[0];
expect(site).to.have.property("bpns", bru.getEnvVar("SUPPLIER_BPNS"));

expect(site.addresses).to.be.an("array").with.lengthOf(1);

const address = site.addresses[0];
expect(address).to.have.property("bpna", bru.getEnvVar("SUPPLIER_BPNA"));
});
}
Loading
Loading