@@ -189,6 +189,103 @@ func TestRepositoryUpdateForkPolicy(t *testing.T) {
189189 }
190190}
191191
192+ func TestGetRepositoryPipelineConfig (t * testing.T ) {
193+ user := os .Getenv ("BITBUCKET_TEST_USERNAME" )
194+ pass := os .Getenv ("BITBUCKET_TEST_PASSWORD" )
195+ owner := os .Getenv ("BITBUCKET_TEST_OWNER" )
196+ repo := os .Getenv ("BITBUCKET_TEST_REPOSLUG" )
197+
198+ if user == "" {
199+ t .Error ("BITBUCKET_TEST_USERNAME is empty." )
200+ }
201+ if pass == "" {
202+ t .Error ("BITBUCKET_TEST_PASSWORD is empty." )
203+ }
204+ if owner == "" {
205+ t .Error ("BITBUCKET_TEST_OWNER is empty." )
206+ }
207+ if repo == "" {
208+ t .Error ("BITBUCKET_TEST_REPOSLUG is empty." )
209+ }
210+
211+ c := bitbucket .NewBasicAuth (user , pass )
212+
213+ opt := & bitbucket.RepositoryPipelineOptions {
214+ Owner : owner ,
215+ RepoSlug : repo ,
216+ }
217+
218+ res , err := c .Repositories .Repository .GetPipelineConfig (opt )
219+ if err != nil {
220+ t .Error (err )
221+ }
222+
223+ if res == nil {
224+ t .Error ("Cannot get pipeline config" )
225+ }
226+ if res .Enabled != false {
227+ t .Error ("Got wrong pipelines config data" )
228+ }
229+ }
230+
231+ func TestUpdateRepositoryPipelineConfig (t * testing.T ) {
232+ user := os .Getenv ("BITBUCKET_TEST_USERNAME" )
233+ pass := os .Getenv ("BITBUCKET_TEST_PASSWORD" )
234+ owner := os .Getenv ("BITBUCKET_TEST_OWNER" )
235+ repo := os .Getenv ("BITBUCKET_TEST_REPOSLUG" )
236+
237+ if user == "" {
238+ t .Error ("BITBUCKET_TEST_USERNAME is empty." )
239+ }
240+ if pass == "" {
241+ t .Error ("BITBUCKET_TEST_PASSWORD is empty." )
242+ }
243+ if owner == "" {
244+ t .Error ("BITBUCKET_TEST_OWNER is empty." )
245+ }
246+ if repo == "" {
247+ t .Error ("BITBUCKET_TEST_REPOSLUG is empty." )
248+ }
249+
250+ c := bitbucket .NewBasicAuth (user , pass )
251+
252+ opt := & bitbucket.RepositoryPipelineOptions {
253+ Owner : owner ,
254+ RepoSlug : repo ,
255+ Enabled : true ,
256+ }
257+
258+ res , err := c .Repositories .Repository .UpdatePipelineConfig (opt )
259+ if err != nil {
260+ t .Error (err )
261+ }
262+
263+ if res == nil {
264+ t .Error ("Cannot update pipeline config" )
265+ }
266+ if res .Enabled != true {
267+ t .Error ("Got wrong pipelines config data" )
268+ }
269+
270+ opt = & bitbucket.RepositoryPipelineOptions {
271+ Owner : owner ,
272+ RepoSlug : repo ,
273+ Enabled : false ,
274+ }
275+
276+ res , err = c .Repositories .Repository .UpdatePipelineConfig (opt )
277+ if err != nil {
278+ t .Error (err )
279+ }
280+
281+ if res == nil {
282+ t .Error ("Cannot update pipeline config" )
283+ }
284+ if res .Enabled != false {
285+ t .Error ("Got wrong pipelines config data" )
286+ }
287+ }
288+
192289func TestGetRepositoryPipelineVariables (t * testing.T ) {
193290
194291 user := os .Getenv ("BITBUCKET_TEST_USERNAME" )
0 commit comments