Skip to content

Commit 07d75b2

Browse files
authored
add test for bitbucket server (#83)
* add test for bitbucket server * add branch test for bb server. * updated assertions from discussion. * remove 'git/' from test cases
1 parent 3e237d4 commit 07d75b2

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

test/git-open.bats

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,45 @@ setup() {
194194
}
195195

196196

197+
@test "bitbucket: Bitbucket Server" {
198+
# https://github.com/paulirish/git-open/issues/77#issuecomment-309044010
199+
git remote set-url origin "https://[email protected]/scm/ppp/rrr.git"
200+
run ../git-open
201+
202+
# any of the following are acceptable
203+
assert_output "https://mybb.domain.com/projects/ppp/repos/rrr" ||
204+
assert_output "https://mybb.domain.com/projects/ppp/repos/rrr/browse/?at=master" ||
205+
assert_output "https://mybb.domain.com/projects/ppp/repos/rrr/browse/?at=refs%2Fheads%2Fmaster"
206+
}
207+
208+
@test "bitbucket: Bitbucket Server branch" {
209+
# https://github.com/paulirish/git-open/issues/80
210+
git remote set-url origin "https://[email protected]/scm/ppp/rrr.git"
211+
git checkout -B "develop"
212+
run ../git-open
213+
214+
# The following query args work with BB Server:
215+
# at=refs%2Fheads%2Fdevelop, at=develop, at=refs/heads/develop
216+
# However /src/develop does not (unlike bitbucket.org)
217+
assert_output "https://mybb.domain.com/projects/ppp/repos/rrr/browse?at=develop" ||
218+
assert_output "https://mybb.domain.com/projects/ppp/repos/rrr/browse?at=refs%2Fheads%2Fdevelop" ||
219+
assert_output "https://mybb.domain.com/projects/ppp/repos/rrr/browse?at=refs/heads/develop"
220+
221+
refute_output --partial "/src/develop"
222+
}
223+
224+
225+
@test "bitbucket: Bitbucket Server private user repos" {
226+
# https://github.com/paulirish/git-open/pull/83#issuecomment-309968538
227+
git remote set-url origin "https://mybb.domain.com/scm/~first.last/rrr.git"
228+
git checkout -B "develop"
229+
run ../git-open
230+
assert_output "https://mybb.domain.com/projects/~first.last/repos/rrr/browse?at=develop" ||
231+
assert_output "https://mybb.domain.com/projects/~first.last/repos/rrr/browse?at=refs%2Fheads%2Fdevelop" ||
232+
assert_output "https://mybb.domain.com/projects/~first.last/repos/rrr/browse?at=refs/heads/develop"
233+
234+
}
235+
197236
##
198237
## GitLab
199238
##

0 commit comments

Comments
 (0)