@@ -224,6 +224,109 @@ func TestContentDelete(t *testing.T) {
224224 }
225225}
226226
227+ func TestContentCreateWithEmptySignature (t * testing.T ) {
228+ defer gock .Off ()
229+
230+ gock .New ("https://api.github.com" ).
231+ Put ("/repos/octocat/hello-world/contents/test/hello" ).
232+ Reply (201 ).
233+ Type ("application/json" ).
234+ SetHeaders (mockHeaders ).
235+ File ("testdata/content_create.json" )
236+
237+ params := & scm.ContentParams {
238+ Message : "my commit message" ,
239+ Data : []byte ("bXkgbmV3IGZpbGUgY29udGVudHM=" ),
240+ Signature : scm.Signature {}, // Empty signature for GitHub App signed commits
241+ }
242+
243+ client := NewDefault ()
244+ res , err := client .Contents .Create (
245+ context .Background (),
246+ "octocat/hello-world" ,
247+ "test/hello" ,
248+ params ,
249+ )
250+
251+ if err != nil {
252+ t .Error (err )
253+ return
254+ }
255+
256+ if res .Status != 201 {
257+ t .Errorf ("Unexpected Results" )
258+ }
259+ }
260+
261+ func TestContentUpdateWithEmptySignature (t * testing.T ) {
262+ defer gock .Off ()
263+
264+ gock .New ("https://api.github.com" ).
265+ Put ("/repos/octocat/hello-world/contents/test/hello" ).
266+ Reply (200 ).
267+ Type ("application/json" ).
268+ SetHeaders (mockHeaders ).
269+ File ("testdata/content_update.json" )
270+
271+ params := & scm.ContentParams {
272+ Message : "a new commit message" ,
273+ Data : []byte ("bXkgdXBkYXRlZCBmaWxlIGNvbnRlbnRz" ),
274+ BlobID : "95b966ae1c166bd92f8ae7d1c313e738c731dfc3" ,
275+ Signature : scm.Signature {}, // Empty signature for GitHub App signed commits
276+ }
277+
278+ client := NewDefault ()
279+ res , err := client .Contents .Update (
280+ context .Background (),
281+ "octocat/hello-world" ,
282+ "test/hello" ,
283+ params ,
284+ )
285+
286+ if err != nil {
287+ t .Error (err )
288+ return
289+ }
290+
291+ if res .Status != 200 {
292+ t .Errorf ("Unexpected Results" )
293+ }
294+ }
295+
296+ func TestContentDeleteWithEmptySignature (t * testing.T ) {
297+ defer gock .Off ()
298+
299+ gock .New ("https://api.github.com" ).
300+ Delete ("/repos/octocat/hello-world/contents/test/hello" ).
301+ Reply (200 ).
302+ Type ("application/json" ).
303+ SetHeaders (mockHeaders ).
304+ File ("testdata/content_delete.json" )
305+
306+ params := & scm.ContentParams {
307+ Message : "a new commit message" ,
308+ BlobID : "95b966ae1c166bd92f8ae7d1c313e738c731dfc3" ,
309+ Signature : scm.Signature {}, // Empty signature for GitHub App signed commits
310+ }
311+
312+ client := NewDefault ()
313+ res , err := client .Contents .Delete (
314+ context .Background (),
315+ "octocat/hello-world" ,
316+ "test/hello" ,
317+ params ,
318+ )
319+
320+ if err != nil {
321+ t .Error (err )
322+ return
323+ }
324+
325+ if res .Status != 200 {
326+ t .Errorf ("Unexpected Results" )
327+ }
328+ }
329+
227330func TestContentList (t * testing.T ) {
228331 defer gock .Off ()
229332
0 commit comments