Skip to content

Commit b0cd921

Browse files
authored
test: updated tests
2 parents 6b6df2e + c49335d commit b0cd921

File tree

5 files changed

+107
-1
lines changed

5 files changed

+107
-1
lines changed

.idea/fattureincloud-go-sdk.iml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
Fatture in Cloud API v2 - API Reference
3+
4+
Connect your software with Fatture in Cloud, the invoicing platform chosen by more than 400.000 businesses in Italy. The Fatture in Cloud API is based on REST, and makes possible to interact with the user related data prior authorization via OAuth2 protocol.
5+
6+
API version: 2.0.19
7+
8+
*/
9+
10+
package model
11+
12+
import (
13+
"encoding/json"
14+
"reflect"
15+
"testing"
16+
17+
. "github.com/fattureincloud/fattureincloud-go-sdk/v2/model"
18+
"github.com/stretchr/testify/assert"
19+
)
20+
21+
var CompanyPlanUsageJsonStr string = "{\"limit\":5,\"usage\":7}"
22+
23+
func TestCompanyPlanUsage(t *testing.T) {
24+
obj := NewCompanyPlanUsage()
25+
json.Unmarshal([]byte(CompanyPlanUsageJsonStr), obj)
26+
jsonStr2, _ := json.Marshal(obj)
27+
28+
assert.JSONEq(t, CompanyPlanUsageJsonStr, string(jsonStr2), "they should be equal")
29+
30+
newObj := NewCompanyPlanUsage()
31+
newObj.SetLimit(obj.GetLimit())
32+
assert.True(t, reflect.DeepEqual(obj.GetLimit(), newObj.GetLimit()))
33+
newObj.SetUsage(obj.GetUsage())
34+
assert.True(t, reflect.DeepEqual(obj.GetUsage(), newObj.GetUsage()))
35+
36+
}

test/model/model_company_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
"github.com/stretchr/testify/assert"
1919
)
2020

21-
var CompanyJsonStr string = "{\"id\":5,\"name\":\"Azienda 1\",\"type\":\"company\",\"access_token\":\"ABCDEF\",\"controlled_companies\":[],\"connection_id\":94817,\"tax_code\":\"SLVMTT50A01F205L\"}"
21+
var CompanyJsonStr string = "{\"id\":5,\"name\":\"Azienda 1\",\"type\":\"company\",\"access_token\":\"ABCDEF\",\"controlled_companies\":[],\"connection_id\":94817,\"tax_code\":\"SLVMTT50A01F205L\",\"fic_plan\":\"standard\",\"fic_license_expire\":\"2024-10-10\"}"
2222

2323
func TestCompany(t *testing.T) {
2424
obj := NewCompany()
@@ -42,4 +42,8 @@ func TestCompany(t *testing.T) {
4242
assert.True(t, reflect.DeepEqual(obj.GetConnectionId(), newObj.GetConnectionId()))
4343
newObj.SetTaxCode(obj.GetTaxCode())
4444
assert.True(t, reflect.DeepEqual(obj.GetTaxCode(), newObj.GetTaxCode()))
45+
newObj.SetFicPlan(obj.GetFicPlan())
46+
assert.True(t, reflect.DeepEqual(obj.GetFicPlan(), newObj.GetFicPlan()))
47+
newObj.SetFicLicenseExpire(obj.GetFicLicenseExpire())
48+
assert.True(t, reflect.DeepEqual(obj.GetFicLicenseExpire(), newObj.GetFicLicenseExpire()))
4549
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
Fatture in Cloud API v2 - API Reference
3+
4+
Connect your software with Fatture in Cloud, the invoicing platform chosen by more than 400.000 businesses in Italy. The Fatture in Cloud API is based on REST, and makes possible to interact with the user related data prior authorization via OAuth2 protocol.
5+
6+
API version: 2.0.19
7+
8+
*/
9+
10+
package model
11+
12+
import (
13+
"testing"
14+
15+
. "github.com/fattureincloud/fattureincloud-go-sdk/v2/model"
16+
"github.com/stretchr/testify/assert"
17+
)
18+
19+
func TestFattureInCloudPlanType(t *testing.T) {
20+
assert.Equal(t, "trial", string(FattureInCloudPlanTypes.TRIAL))
21+
assert.Equal(t, "standard", string(FattureInCloudPlanTypes.STANDARD))
22+
assert.Equal(t, "premium", string(FattureInCloudPlanTypes.PREMIUM))
23+
assert.Equal(t, "premium_plus", string(FattureInCloudPlanTypes.PREMIUM_PLUS))
24+
assert.Equal(t, "complete", string(FattureInCloudPlanTypes.COMPLETE))
25+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
Fatture in Cloud API v2 - API Reference
3+
4+
Connect your software with Fatture in Cloud, the invoicing platform chosen by more than 400.000 businesses in Italy. The Fatture in Cloud API is based on REST, and makes possible to interact with the user related data prior authorization via OAuth2 protocol.
5+
6+
API version: 2.0.19
7+
8+
*/
9+
10+
package model
11+
12+
import (
13+
"encoding/json"
14+
"reflect"
15+
"testing"
16+
17+
. "github.com/fattureincloud/fattureincloud-go-sdk/v2/model"
18+
"github.com/stretchr/testify/assert"
19+
)
20+
21+
var GetCompanyPlanUsageResponseJsonStr string = "{\"data\":{\"limit\":5,\"usage\":7}}"
22+
23+
func TestGetCompanyPlanUsageResponse(t *testing.T) {
24+
obj := NewGetCompanyPlanUsageResponse()
25+
json.Unmarshal([]byte(GetCompanyPlanUsageResponseJsonStr), obj)
26+
jsonStr2, _ := json.Marshal(obj)
27+
28+
assert.JSONEq(t, GetCompanyPlanUsageResponseJsonStr, string(jsonStr2), "they should be equal")
29+
30+
newObj := NewGetCompanyPlanUsageResponse()
31+
newObj.SetData(obj.GetData())
32+
assert.True(t, reflect.DeepEqual(obj.GetData(), newObj.GetData()))
33+
}

0 commit comments

Comments
 (0)