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

fix(ui-extensions): use the new version response when returning #46

Merged
merged 2 commits into from
Apr 6, 2024
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
6 changes: 3 additions & 3 deletions pkg/c8y/uiExtension.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ func (s *UIExtensionService) CreateExtension(ctx context.Context, application *A
}

// Upload binary
binaryVersion, resp, err := s.client.ApplicationVersions.CreateVersion(ctx, app.ID, filename, *opt.Version)
binaryVersion, binaryVersionResponse, err := s.client.ApplicationVersions.CreateVersion(ctx, app.ID, filename, *opt.Version)
if err != nil {
return nil, resp, err
return nil, binaryVersionResponse, err
}

if binaryVersion != nil {
Expand All @@ -197,7 +197,7 @@ func (s *UIExtensionService) CreateExtension(ctx context.Context, application *A
}
}

return binaryVersion, resp, err
return binaryVersion, binaryVersionResponse, err
}

func (s *UIExtensionService) SetActive(ctx context.Context, appID string, binaryID string) (*Application, *Response, error) {
Expand Down
3 changes: 2 additions & 1 deletion test/c8y_test/uiExtension_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestUIExtensionService_CreateExtension(t *testing.T) {
app1.ContextPath = app1.Name
testingutils.Ok(t, err)

appVersion1, _, err := client.UIExtension.CreateExtension(context.Background(), &app1.Application, file1.Name(), c8y.UpsertOptions{
appVersion1, resp, err := client.UIExtension.CreateExtension(context.Background(), &app1.Application, file1.Name(), c8y.UpsertOptions{
SkipActivation: false,
Version: &c8y.ApplicationVersion{
Version: app1.ManifestFile.Version,
Expand All @@ -45,6 +45,7 @@ func TestUIExtensionService_CreateExtension(t *testing.T) {
client.Application.Delete(context.Background(), appVersion1.Application.ID)
})
testingutils.Ok(t, err)
testingutils.Equals(t, "2.4.3", resp.JSON("version").String())
testingutils.Equals(t, "2.4.3", appVersion1.Version)
testingutils.Assert(t, len(appVersion1.Tags) == 2, "Tags should be present")
testingutils.ContainsString(t, "tag1", appVersion1.Tags)
Expand Down