@@ -39,9 +39,7 @@ test.serial('Publish a release', async t => {
3939 const options = { repositoryUrl : `https://gitlab.com/${ owner } /${ repo } .git` } ;
4040
4141 const gitlab = authenticate ( )
42- . get ( `/projects/${ owner } %2F${ repo } /repository/tags/${ nextRelease . gitTag } ` )
43- . reply ( 404 )
44- . post ( `/projects/${ owner } %2F${ repo } /repository/tags/${ nextRelease . gitTag } /release` , {
42+ . put ( `/projects/${ owner } %2F${ repo } /repository/tags/${ nextRelease . gitTag } /release` , {
4543 tag_name : nextRelease . gitTag ,
4644 ref : nextRelease . gitHead ,
4745 release_description : nextRelease . notes ,
@@ -53,44 +51,3 @@ test.serial('Publish a release', async t => {
5351 t . deepEqual ( t . context . log . args [ 0 ] , [ 'Published GitLab release: %s' , nextRelease . gitTag ] ) ;
5452 t . true ( gitlab . isDone ( ) ) ;
5553} ) ;
56-
57- test . serial ( 'Publish a release with an existing tag' , async t => {
58- const owner = 'test_user' ;
59- const repo = 'test_repo' ;
60- process . env . GITLAB_TOKEN = 'gitlab_token' ;
61- const pluginConfig = { } ;
62- const nextRelease = { gitHead : '123' , gitTag : 'v1.0.0' , notes : 'Test release note body' } ;
63- const options = { branch : 'master' , repositoryUrl : `https://gitlab.com/${ owner } /${ repo } .git` } ;
64-
65- const gitlab = authenticate ( )
66- . get ( `/projects/${ owner } %2F${ repo } /repository/tags/${ nextRelease . gitTag } ` )
67- . reply ( 200 , { name : nextRelease . gitTag } )
68- . post ( `/projects/${ owner } %2F${ repo } /repository/tags/${ nextRelease . gitTag } /release` , {
69- tag_name : nextRelease . gitTag ,
70- description : nextRelease . notes ,
71- } )
72- . reply ( 200 ) ;
73-
74- await publish ( pluginConfig , options , nextRelease , t . context . logger ) ;
75-
76- t . deepEqual ( t . context . log . args [ 0 ] , [ 'Published GitLab release: %s' , nextRelease . gitTag ] ) ;
77- t . true ( gitlab . isDone ( ) ) ;
78- } ) ;
79-
80- test . serial ( 'Throw Error if get tag call return an error other than 404' , async t => {
81- const owner = 'test_user' ;
82- const repo = 'test_repo' ;
83- process . env . GITLAB_TOKEN = 'github_token' ;
84- const pluginConfig = { } ;
85- const nextRelease = { gitHead : '123' , gitTag : 'v1.0.0' , notes : 'Test release note body' } ;
86- const options = { branch : 'master' , repositoryUrl : `https://github.com/${ owner } /${ repo } .git` } ;
87-
88- const github = authenticate ( )
89- . get ( `/projects/${ owner } %2F${ repo } /repository/tags/${ nextRelease . gitTag } ` )
90- . reply ( 500 ) ;
91-
92- const error = await t . throws ( publish ( pluginConfig , options , nextRelease , t . context . logger ) , Error ) ;
93-
94- t . is ( error . statusCode , 500 ) ;
95- t . true ( github . isDone ( ) ) ;
96- } ) ;
0 commit comments