Test delition of repository

This commit is contained in:
Colin Wood 2016-09-08 12:42:40 -07:00
parent 32b5493e57
commit 60351421da
1 changed files with 16 additions and 0 deletions

View File

@ -36,6 +36,22 @@ func TestAccBitbucketRepository_basic(t *testing.T) {
} }
func testAccCheckBitbucketRepositoryDestroy(s *terraform.State) error { func testAccCheckBitbucketRepositoryDestroy(s *terraform.State) error {
client := testAccProvider.Meta().(*BitbucketClient)
rs, ok := s.RootModule().Resources["bitbucket_repository.test_repo"]
if !ok {
return fmt.Errorf("Not found %s", "bitbucket_repository.test_repo")
}
response, err := client.Get(fmt.Sprintf("2.0/repositories/%s/%s", rs.Primary.Attributes["owner"], rs.Primary.Attributes["name"]))
if err != nil {
return err
}
if response.StatusCode != 404 {
return fmt.Errorf("Repository still exists")
}
return nil return nil
} }