1- // Copyright 2021-2024 Contributors to the Veraison project.
1+ // Copyright 2021-2026 Contributors to the Veraison project.
22// SPDX-License-Identifier: Apache-2.0
33
44package cmd
@@ -7,11 +7,11 @@ import (
77 "errors"
88 "testing"
99
10- "github.com/golang/mock/gomock"
1110 "github.com/spf13/afero"
1211 "github.com/stretchr/testify/assert"
1312 "github.com/stretchr/testify/require"
1413 mock_deps "github.com/veraison/cocli/cmd/mocks"
14+ "go.uber.org/mock/gomock"
1515)
1616
1717func Test_CorimSubmitCmd_bad_server_url (t * testing.T ) {
@@ -24,7 +24,7 @@ func Test_CorimSubmitCmd_bad_server_url(t *testing.T) {
2424 args := []string {
2525 "--corim-file=corim.cbor" ,
2626 "--api-server=http://www.example.com:80index" ,
27- "--media-type=application/corim-unsigned+cbor; profile=http:// arm.com/ psa/iot/1 " ,
27+ "--media-type=application/corim-unsigned+cbor; profile=tag: arm.com,2025: psa#1.0.0 " ,
2828 }
2929 cmd .SetArgs (args )
3030
@@ -45,7 +45,7 @@ func Test_CorimSubmitCmd_missing_server_url(t *testing.T) {
4545
4646 args := []string {
4747 "--corim-file=corim.cbor" ,
48- "--media-type=application/corim-unsigned+cbor; profile=http:// arm.com/ psa/iot/1 " ,
48+ "--media-type=application/corim-unsigned+cbor; profile=tag: arm.com,2025: psa#1.0.0 " ,
4949 }
5050 cmd .SetArgs (args )
5151
@@ -90,7 +90,7 @@ func Test_CorimSubmitCmd_missing_corim_file(t *testing.T) {
9090 args := []string {
9191 "--corim-file=" ,
9292 "--api-server=http://www.example.com:8080" ,
93- "--media-type=application/corim-unsigned+cbor; profile=http:// arm.com/ psa/iot/1 " ,
93+ "--media-type=application/corim-unsigned+cbor; profile=tag: arm.com,2025: psa#1.0.0 " ,
9494 }
9595 cmd .SetArgs (args )
9696
@@ -109,7 +109,7 @@ func Test_CorimSubmitCmd_non_existent_corim_file(t *testing.T) {
109109 args := []string {
110110 "--corim-file=bad.cbor" ,
111111 "--api-server=http://www.example.com:8080" ,
112- "--media-type=application/corim-unsigned+cbor; profile=http:// arm.com/ psa/iot/1 " ,
112+ "--media-type=application/corim-unsigned+cbor; profile=tag: arm.com,2025: psa#1.0.0 " ,
113113 }
114114 cmd .SetArgs (args )
115115
@@ -127,7 +127,7 @@ func Test_CorimSubmitCmd_submit_ok(t *testing.T) {
127127 args := []string {
128128 "--corim-file=corim.cbor" ,
129129 "--api-server=http://veraison.example/endorsement-provisioning/v1/submit" ,
130- "--media-type=application/corim-unsigned+cbor; profile=http:// arm.com/ psa/iot/1 " ,
130+ "--media-type=application/corim-unsigned+cbor; profile=tag: arm.com,2025: psa#1.0.0 " ,
131131 }
132132 cmd .SetArgs (args )
133133
@@ -139,7 +139,7 @@ func Test_CorimSubmitCmd_submit_ok(t *testing.T) {
139139 ms .EXPECT ().SetIsInsecure (false )
140140 ms .EXPECT ().SetCerts ([]string {})
141141 ms .EXPECT ().SetDeleteSession (true )
142- ms .EXPECT ().Run (testSignedCorimValid , "application/corim-unsigned+cbor; profile=http:// arm.com/ psa/iot/1 " ).Return (nil )
142+ ms .EXPECT ().Run (testSignedCorimValid , "application/corim-unsigned+cbor; profile=tag: arm.com,2025: psa#1.0.0 " ).Return (nil )
143143 err = cmd .Execute ()
144144 assert .NoError (t , err )
145145}
@@ -154,7 +154,7 @@ func Test_CorimSubmitCmd_submit_not_ok(t *testing.T) {
154154 args := []string {
155155 "--corim-file=corim.cbor" ,
156156 "--api-server=http://veraison.example/endorsement-provisioning/v1/submit" ,
157- "--media-type=application/corim-unsigned+cbor; profile=http:// arm.com/ psa/iot/1 " ,
157+ "--media-type=application/corim-unsigned+cbor; profile=tag: arm.com,2025: psa#1.0.0 " ,
158158 }
159159 cmd .SetArgs (args )
160160
@@ -168,7 +168,7 @@ func Test_CorimSubmitCmd_submit_not_ok(t *testing.T) {
168168 ms .EXPECT ().SetDeleteSession (true )
169169 err = errors .New (`unexpected HTTP response code 404` )
170170
171- ms .EXPECT ().Run (testSignedCorimValid , "application/corim-unsigned+cbor; profile=http:// arm.com/ psa/iot/1 " ).Return (err )
171+ ms .EXPECT ().Run (testSignedCorimValid , "application/corim-unsigned+cbor; profile=tag: arm.com,2025: psa#1.0.0 " ).Return (err )
172172 err = cmd .Execute ()
173173 assert .EqualError (t , err , "submit CoRIM payload failed reason: run failed: unexpected HTTP response code 404" )
174174}
0 commit comments