Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/inventree_test_hash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fa0d892a62900acdc1af081e51e017fb40b17f22
71c2f5ca735c041c5faa849832635da2e58883a0
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.w3asel</groupId>
<artifactId>inventree-sdk-java</artifactId>
<packaging>jar</packaging>
<version>1.1.430-SNAPSHOT</version>
<version>1.1.431-SNAPSHOT</version>

<name>InvenTree SDK (Java)</name>
<description>A Java implementation of the OpenAPI spec published by InvenTree.</description>
Expand Down
27 changes: 3 additions & 24 deletions src/main/resources/api.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.3
info:
title: InvenTree API
version: '430'
version: '431'
description: API for InvenTree - the intuitive open source inventory management
system
license:
Expand Down Expand Up @@ -28091,13 +28091,6 @@ components:
title: Phone number
description: Contact phone number
maxLength: 50
address:
type: string
readOnly: true
nullable: true
title: Primary Address
description: Return the string representation for the primary address. This
property exists for backwards compatibility.
email:
type: string
format: email
Expand Down Expand Up @@ -28159,12 +28152,9 @@ components:
format: uri
writeOnly: true
description: URL of remote image file
address_count:
type: integer
readOnly: true
primary_address:
allOf:
- $ref: '#/components/schemas/Address'
- $ref: '#/components/schemas/AddressBrief'
readOnly: true
nullable: true
tax_id:
Expand All @@ -28177,7 +28167,6 @@ components:
$ref: '#/components/schemas/Parameter'
readOnly: true
required:
- address_count
- currency
- name
- parameters
Expand Down Expand Up @@ -34183,13 +34172,6 @@ components:
title: Phone number
description: Contact phone number
maxLength: 50
address:
type: string
readOnly: true
nullable: true
title: Primary Address
description: Return the string representation for the primary address. This
property exists for backwards compatibility.
email:
type: string
format: email
Expand Down Expand Up @@ -34251,12 +34233,9 @@ components:
format: uri
writeOnly: true
description: URL of remote image file
address_count:
type: integer
readOnly: true
primary_address:
allOf:
- $ref: '#/components/schemas/Address'
- $ref: '#/components/schemas/AddressBrief'
readOnly: true
nullable: true
tax_id:
Expand Down
5 changes: 2 additions & 3 deletions src/test/java/com/w3asel/inventree/api/TestBuildApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,8 @@ void buildRetrieve(int pk) throws ApiException {
assertBuildEquals(expected, actual, false);

// verify data not directly in demo dataset
// TODO overdue filter works like this, actual results come back not overdue
// actual.getTargetDate() != null && actual.getTargetDate().isBefore(LocalDate.now());
boolean expectedOverdue = false;
boolean expectedOverdue =
actual.getTargetDate() != null && actual.getTargetDate().isBefore(LocalDate.now());

String expectedIssuedByName;
String expectedPartName;
Expand Down
22 changes: 17 additions & 5 deletions src/test/java/com/w3asel/inventree/api/TestCompanyApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.w3asel.inventree.InventreeDemoDataset.Model;
import com.w3asel.inventree.invoker.ApiException;
import com.w3asel.inventree.model.Address;
import com.w3asel.inventree.model.AddressBrief;
import com.w3asel.inventree.model.BulkRequest;
import com.w3asel.inventree.model.Company;
import com.w3asel.inventree.model.CompanyBrief;
Expand Down Expand Up @@ -188,13 +189,9 @@ void companyRetrieve(int company) throws ApiException {

// verify data not directly in demo dataset
if (1 == company) {
assertEquals("04964 Cox View Suite 815, 94832, Wesleyport, Delaware, Bolivia",
actual.getAddress(), "Incorrect address");
assertEquals(2, actual.getAddressCount(), "Incorrect address count");

JsonObject expectedAddress =
InventreeDemoDataset.getObjects(Model.COMPANY_ADDRESS, 54).get(0);
assertAddressEquals(expectedAddress, actual.getPrimaryAddress());
assertAddressBriefEquals(expectedAddress, actual.getPrimaryAddress());

assertEquals(0, actual.getPartsManufactured(), "Incorrect parts manufactured");
assertEquals(200, actual.getPartsSupplied(), "Incorrect parts supplied");
Expand All @@ -206,6 +203,21 @@ void companyRetrieve(int company) throws ApiException {
}
}

private static void assertAddressBriefEquals(JsonObject expected, AddressBrief actual) {
assertFieldEquals(InventreeDemoDataset.PRIMARY_KEY_KEY, expected, actual.getPk());

JsonObject fields = InventreeDemoDataset.getFields(expected);

assertFieldEquals("line1", fields, actual.getLine1());
assertFieldEquals("line2", fields, actual.getLine2());
assertFieldEquals("postal_code", fields, actual.getPostalCode());
assertFieldEquals("postal_city", fields, actual.getPostalCity());
assertFieldEquals("province", fields, actual.getProvince());
assertFieldEquals("country", fields, actual.getCountry());
assertFieldEquals("shipping_notes", fields, actual.getShippingNotes());
assertFieldEquals("internal_shipping_notes", fields, actual.getInternalShippingNotes());
}

private static void assertAddressEquals(JsonObject expected, Address actual) {
assertFieldEquals(InventreeDemoDataset.PRIMARY_KEY_KEY, expected, actual.getPk());

Expand Down