Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Commit

Permalink
Merge pull request #116 from guilhermef/master
Browse files Browse the repository at this point in the history
More GetTree tests
  • Loading branch information
andrewsmedina committed Jul 3, 2014
2 parents 4a0e57b + 6e60b26 commit 800eb33
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions repository/repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,3 +735,36 @@ func (s *S) TestGetArchiveIntegrationWhenInvalidRepo(c *gocheck.C) {
_, err := GetArchive("invalid-repo", "master", Zip)
c.Assert(err.Error(), gocheck.Equals, "Error when trying to obtain archive for ref master of repository invalid-repo (Repository does not exist).")
}

func (s *S) TestGetTreeIntegrationWithMissingFile(c *gocheck.C) {
oldBare := bare
bare = "/tmp"
repo := "gandalf-test-repo"
file := "README"
content := "very WOW"
cleanUp, errCreate := CreateTestRepository(bare, repo, file, content)
defer func() {
cleanUp()
bare = oldBare
}()
c.Assert(errCreate, gocheck.IsNil)
tree, err := GetTree(repo, "master", "very missing")
c.Assert(err, gocheck.IsNil)
c.Assert(tree, gocheck.HasLen, 0)
}

func (s *S) TestGetTreeIntegrationWithInvalidRef(c *gocheck.C) {
oldBare := bare
bare = "/tmp"
repo := "gandalf-test-repo"
file := "README"
content := "very WOW"
cleanUp, errCreate := CreateTestRepository(bare, repo, file, content)
defer func() {
cleanUp()
bare = oldBare
}()
c.Assert(errCreate, gocheck.IsNil)
_, err := GetTree(repo, "VeryInvalid", "very missing")
c.Assert(err, gocheck.ErrorMatches, "^Error when trying to obtain tree very missing on ref VeryInvalid of repository gandalf-test-repo \\(exit status 128\\)\\.$")
}

0 comments on commit 800eb33

Please sign in to comment.