Skip to content

Commit

Permalink
Add contributors/owner to import API tests
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Lucidi <[email protected]>
  • Loading branch information
mansam committed Nov 8, 2023
1 parent c4d9129 commit 2b59b8c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 7 deletions.
20 changes: 17 additions & 3 deletions test/api/importcsv/api_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package importcsv

import (
"github.com/konveyor/tackle2-hub/api"
"github.com/konveyor/tackle2-hub/binding"
"github.com/konveyor/tackle2-hub/test/assert"
"io/ioutil"
"os"
"testing"
"time"
"github.com/konveyor/tackle2-hub/api"
"github.com/konveyor/tackle2-hub/binding"
"github.com/konveyor/tackle2-hub/test/assert"
)

func TestImportCSV(t *testing.T) {
Expand Down Expand Up @@ -68,6 +68,20 @@ func TestImportCSV(t *testing.T) {
if r.ExpectedApplications[i].BusinessService.Name != gotApp.BusinessService.Name {
t.Errorf("Mismatch in name of the BusinessService of imported Application: Expected %s, Actual %s", r.ExpectedApplications[i].BusinessService.Name, gotApp.BusinessService.Name)
}
if gotApp.Owner == nil || r.ExpectedApplications[i].Owner == nil {
if gotApp.Owner != r.ExpectedApplications[i].Owner {
t.Errorf("Mismatch in value of Owner on imported Application: Expected %v, Actual %v", r.ExpectedApplications[i].Owner, gotApp.BusinessService)
}
} else if r.ExpectedApplications[i].Owner.Name != gotApp.Owner.Name {
t.Errorf("Mismatch in name of the Owner of imported Application: Expected %s, Actual %s", r.ExpectedApplications[i].Owner.Name, gotApp.BusinessService.Name)
}
if len(gotApp.Contributors) != len(r.ExpectedApplications[i].Contributors) {
t.Errorf("Mismatch in number of Contributors: Expected %d, Actual %d", len(r.ExpectedApplications[i].Contributors), len(gotApp.Contributors))
} else {
for j, contributor := range gotApp.Contributors {
if contributor.Name != r.ExpectedApplications[i].Contributors[j].Name {}
}
}
}
}

Expand Down
22 changes: 22 additions & 0 deletions test/api/importcsv/samples.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ var (
BusinessService: &api.Ref{
Name: "Retail",
},
Owner: &api.Ref{
Name: "John Doe",
},
},
{
Name: "Inventory",
Expand Down Expand Up @@ -82,6 +85,14 @@ var (
BusinessService: &api.Ref{
Name: "Retail",
},
Contributors: []api.Ref{
{
Name: "John Doe",
},
{
Name: "Jane Smith",
},
},
},
{
Name: "Gateway",
Expand Down Expand Up @@ -112,6 +123,17 @@ var (
BusinessService: &api.Ref{
Name: "Retail",
},
Owner: &api.Ref{
Name: "John Doe",
},
Contributors: []api.Ref{
{
Name: "John Doe",
},
{
Name: "Jane Smith",
},
},
},
},
ExpectedDependencies: []api.Dependency{
Expand Down
8 changes: 4 additions & 4 deletions test/api/importcsv/template_application_import.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Record Type 1,Application Name,Description,Comments,Business Service,Dependency,Dependency Direction,Binary Group,Binary Artifact,Binary Version,Binary Packaging,Repository Type,Repository URL,Repository Branch,Repository Path,Tag Category 1,Tag 1,Tag Category 2,Tag 2,Tag Category 3,Tag 3,Tag Category 4,Tag 4,Tag Category 5,Tag 5,Tag Category 6,Tag 6,Tag Category 7,Tag 7,Tag Category 8,Tag 8,Tag Category 9,Tag 9,Tag Category 10,Tag 10,Tag Category 11,Tag 11,Tag Category 12,Tag 12,Tag Category 13,Tag 13,Tag Category 14,Tag 14,Tag Category 15,Tag 15,Tag Category 16,Tag 16,Tag Category 17,Tag 17,Tag Category 18,Tag 18,Tag Category 19,Tag 19,Tag Category 20,Tag 20
1,Customers,Legacy Customers management service,,Retail,,,corp.acme.demo,customers-tomcat,0.0.1-SNAPSHOT,war,git,https://git-acme.local/customers.git,,,Operating System,RHEL 8,Database,Oracle,Language,Java,Runtime,Tomcat,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
1,Inventory,Inventory service,,Retail,,,corp.acme.demo,inventory,0.1.1-SNAPSHOT,war,git,https://git-acme.local/inventory.git,,,Operating System,RHEL 8,Database,Postgresql,Language,Java,Runtime,Quarkus,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
1,Gateway,API Gateway,,Retail,,,corp.acme.demo,gateway,0.1.1-SNAPSHOT,war,git,https://git-acme.local/gateway.git,,,Operating System,RHEL 8,,,Language,Java,Runtime,Spring Boot,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Record Type 1,Application Name,Description,Comments,Business Service,Dependency,Dependency Direction,Binary Group,Binary Artifact,Binary Version,Binary Packaging,Repository Type,Repository URL,Repository Branch,Repository Path,Owner,Contributors,Tag Category 1,Tag 1,Tag Category 2,Tag 2,Tag Category 3,Tag 3,Tag Category 4,Tag 4,Tag Category 5,Tag 5,Tag Category 6,Tag 6,Tag Category 7,Tag 7,Tag Category 8,Tag 8,Tag Category 9,Tag 9,Tag Category 10,Tag 10,Tag Category 11,Tag 11,Tag Category 12,Tag 12,Tag Category 13,Tag 13,Tag Category 14,Tag 14,Tag Category 15,Tag 15,Tag Category 16,Tag 16,Tag Category 17,Tag 17,Tag Category 18,Tag 18,Tag Category 19,Tag 19,Tag Category 20,Tag 20
1,Customers,Legacy Customers management service,,Retail,,,corp.acme.demo,customers-tomcat,0.0.1-SNAPSHOT,war,git,https://git-acme.local/customers.git,,,John Doe <[email protected]>,,Operating System,RHEL 8,Database,Oracle,Language,Java,Runtime,Tomcat,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
1,Inventory,Inventory service,,Retail,,,corp.acme.demo,inventory,0.1.1-SNAPSHOT,war,git,https://git-acme.local/inventory.git,,,,"John Doe <[email protected]>, Jane Smith <[email protected]>",Operating System,RHEL 8,Database,Postgresql,Language,Java,Runtime,Quarkus,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
1,Gateway,API Gateway,,Retail,,,corp.acme.demo,gateway,0.1.1-SNAPSHOT,war,git,https://git-acme.local/gateway.git,,,John Doe <[email protected]>,"John Doe <[email protected]>, Jane Smith <[email protected]>",Operating System,RHEL 8,,,Language,Java,Runtime,Spring Boot,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
2,Gateway,,,,Inventory,southbound
2,Gateway,,,,Customers,southbound

0 comments on commit 2b59b8c

Please sign in to comment.