Skip to content

Commit 2ef17f0

Browse files
author
Yohei TSUJI
committed
Added test cases for AWS Code Commit.
1 parent c68b9c1 commit 2ef17f0

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

git-open

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ elif [[ "${#pathargs[@]}" -ge '2' && ${pathargs[${#pathargs[@]} - 2]} == '_git'
198198
fi
199199
elif [[ "$domain" =~ amazonaws\.com$ ]]; then
200200
# AWS Code Commit
201+
if (( is_issue )); then
202+
echo "Issue feature does not supported on AWS Code Commit." 1>&2
203+
exit 1
204+
fi
205+
201206
# Take region name from domain.
202207
region=${domain#*.}
203208
region=${region%%.*}

test/git-open.bats

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,39 @@ setup() {
503503
assert_output "https://gitopen.visualstudio.com/Project/_workitems?id=36"
504504
}
505505

506+
##
507+
## AWS Code Commit
508+
##
509+
510+
@test "aws: https url" {
511+
git remote set-url origin "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo"
512+
git checkout -B "master"
513+
run ../git-open
514+
assert_output "https://us-east-1.console.aws.amazon.com/codecommit/home?region=us-east-1#/repository/repo/browse/"
515+
}
516+
517+
@test "aws: ssh url" {
518+
git remote set-url origin "ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo"
519+
git checkout -B "master"
520+
run ../git-open
521+
assert_output "https://us-east-1.console.aws.amazon.com/codecommit/home?region=us-east-1#/repository/repo/browse/"
522+
}
523+
524+
@test "aws: branch " {
525+
git remote set-url origin "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo"
526+
git checkout -B "mybranch"
527+
run ../git-open
528+
assert_output "https://us-east-1.console.aws.amazon.com/codecommit/home?region=us-east-1#/repository/repo/browse/mybranch/--/"
529+
}
530+
531+
@test "aws: issue" {
532+
git remote set-url origin "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/repo"
533+
git checkout -B "issues/#12"
534+
run ../git-open "--issue"
535+
[ "$status" -eq 1 ]
536+
assert_output "Issue feature does not supported on AWS Code Commit."
537+
}
538+
506539

507540
teardown() {
508541
cd ..

0 commit comments

Comments
 (0)