ruby_git_hooks 0.0.31

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,162 @@
1
+ # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
2
+
3
+ require "test_helper"
4
+
5
+ require "minitest/autorun"
6
+ require "pony"
7
+
8
+ class RealCopyrightCheckHookTest < HookTestCase
9
+ REPOS_DIR = File.expand_path File.join(File.dirname(__FILE__), "repos")
10
+ FAKE_MAILER = File.join(File.dirname(__FILE__), "fake_mailer")
11
+ MAILER_FILE = File.join(File.dirname(__FILE__), "mail_params")
12
+ TEST_HOOK_BASIC = <<TEST
13
+ #{RubyGitHooks.shebang}
14
+ require "ruby_git_hooks/copyright_check"
15
+
16
+ RubyGitHooks.register CopyrightCheckHook.new("domain" => "example.com",
17
+ "from" => "Copyright Enforcement <noreply@example.com>",
18
+ "via" => :sendmail,
19
+ "via_options" => {
20
+ :location => #{FAKE_MAILER.inspect},
21
+ :arguments => '#{MAILER_FILE.inspect}'
22
+ }
23
+ )
24
+
25
+ RubyGitHooks.run
26
+ TEST
27
+
28
+ TEST_HOOK_COMPANY = <<TEST
29
+ #{RubyGitHooks.shebang}
30
+ require "ruby_git_hooks/copyright_check"
31
+
32
+ RubyGitHooks.register CopyrightCheckHook.new("domain" => "example.com",
33
+ "from" => "Copyright Enforcement <noreply@example.com>",
34
+ "company_check" => /YoYoDyne (Industries)?/i,
35
+ "via" => :sendmail,
36
+ "via_options" => {
37
+ :location => #{FAKE_MAILER.inspect},
38
+ :arguments => '#{MAILER_FILE.inspect}'
39
+ }
40
+ )
41
+
42
+ RubyGitHooks.run
43
+ TEST
44
+
45
+ TEST_HOOK_NO_SEND = <<TEST
46
+ #{RubyGitHooks.shebang}
47
+ require "ruby_git_hooks/copyright_check"
48
+
49
+ RubyGitHooks.run CopyrightCheckHook.new("no_send" => true)
50
+ TEST
51
+
52
+ TEST_HOOK_EXCLUDE = <<TEST
53
+ #{RubyGitHooks.shebang}
54
+ require "ruby_git_hooks/copyright_check"
55
+
56
+ RubyGitHooks.register CopyrightCheckHook.new("domain" => "example.com",
57
+ "from" => "Copyright Enforcement <noreply@example.com>",
58
+ "via" => :sendmail,
59
+ "via_options" => {
60
+ :location => #{FAKE_MAILER.inspect},
61
+ :arguments => '#{MAILER_FILE.inspect}'
62
+ },
63
+ "exclude_files" => ["schema.rb"]
64
+ )
65
+
66
+ RubyGitHooks.run
67
+ TEST
68
+
69
+ def setup
70
+ # Empty out the test repos dir
71
+ Hook.shell! "rm -rf #{File.join(REPOS_DIR, "*")}"
72
+
73
+ # Remove test mail file
74
+ Hook.shell! "rm -f #{MAILER_FILE}"
75
+ raise "Couldn't delete #{MAILER_FILE}!" if File.exist? MAILER_FILE
76
+
77
+ # Create local parent and child repos with a single shared commit
78
+ Dir.chdir REPOS_DIR
79
+
80
+ new_bare_repo
81
+ clone_repo
82
+ new_commit "child_repo", "README"
83
+ git_push
84
+ end
85
+
86
+ def test_copyright_post_commit
87
+ add_hook("child_repo", "post-commit", TEST_HOOK_BASIC)
88
+
89
+ new_commit("child_repo", "file_w_no_copy_notice.rb", <<FILE_CONTENTS)
90
+ # No copyright notice!
91
+ FILE_CONTENTS
92
+
93
+ mail_out = File.read MAILER_FILE
94
+
95
+ # Should get email with the most recent commit about
96
+ # file_w_no_copy_notice.rb, which has no copyright notice.
97
+ assert mail_out.include?(last_commit_sha[0..6]),
98
+ "Mail message must include latest SHA!"
99
+ assert mail_out.include?("file_w_no_copy_notice.rb"),
100
+ "Mail message must mention file_w_no_copy_notice.rb!"
101
+ end
102
+
103
+ def test_copyright_no_send_option
104
+ add_hook("child_repo", "post-commit", TEST_HOOK_NO_SEND)
105
+
106
+ new_commit("child_repo", "file_w_no_copy_notice_but_nosend.rb", <<FILE_CONTENTS)
107
+ # No copyright notice!
108
+ FILE_CONTENTS
109
+
110
+ assert !File.exist?(MAILER_FILE),
111
+ "Copyright test must not send email if 'no_send' is set!"
112
+ end
113
+
114
+ def test_copyright_basic_correct
115
+ add_hook("child_repo", "post-commit", TEST_HOOK_BASIC)
116
+
117
+ new_commit("child_repo", "correct_file.rb", <<FILE_CONTENTS)
118
+ # Copyright (C) 1941-2013 YoyoDyne, Inc. All Rights Reserved.
119
+ FILE_CONTENTS
120
+
121
+ assert !File.exist?(MAILER_FILE), "Copyright test must not send email!"
122
+ end
123
+
124
+ def test_copyright_company_correct
125
+ add_hook("child_repo", "post-commit", TEST_HOOK_COMPANY)
126
+
127
+ new_commit("child_repo", "correct_file.rb", <<FILE_CONTENTS)
128
+ # Copyright (C) 1941-2013 YoyoDyne Industries All Rights Reserved.
129
+ FILE_CONTENTS
130
+
131
+ assert !File.exist?(MAILER_FILE), "Copyright test must not send email!"
132
+ end
133
+
134
+ def test_copyright_company_incorrect
135
+ add_hook("child_repo", "post-commit", TEST_HOOK_COMPANY)
136
+
137
+ new_commit("child_repo", "correct_file.rb", <<FILE_CONTENTS)
138
+ # Copyright (C) 1941-2013 YoyoWrong All Rights Reserved.
139
+ FILE_CONTENTS
140
+
141
+ assert File.exist?(MAILER_FILE), "Must email about wrong company name!"
142
+ end
143
+
144
+ def test_copyright_no_first_year
145
+ add_hook("child_repo", "post-commit", TEST_HOOK_BASIC)
146
+
147
+ new_commit("child_repo", "correct_file_single_year.rb", <<FILE_CONTENTS)
148
+ # Copyright (C) 2013 YoyoDyne, Inc. All Rights Reserved.
149
+ FILE_CONTENTS
150
+
151
+ assert !File.exist?(MAILER_FILE), "Copyright test must not send email!"
152
+ end
153
+
154
+ def test_copyright_exclude_files
155
+ add_hook("child_repo", "post-commit", TEST_HOOK_EXCLUDE)
156
+ new_commit("child_repo", "schema.rb", <<FILE_CONTENTS)
157
+ # NO copyright but I'm an excluded file.
158
+ FILE_CONTENTS
159
+ assert !File.exist?(MAILER_FILE), "Copyright test must not send email!"
160
+ end
161
+
162
+ end
data/test/fake_curl ADDED
@@ -0,0 +1,12 @@
1
+ #!/bin/bash
2
+
3
+ echo $*
4
+
5
+ if [[ "$*" =~ GOOD-[0-9]{1,6} ]] ; then
6
+ echo "HTTP/1.1 200 OK"
7
+ exit 0
8
+ fi
9
+
10
+ echo "HTTP/1.1 404 Not Found"
11
+ exit 0
12
+
data/test/fake_mailer ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ echo $* > $1
4
+ echo ----- >> $1
5
+ cat /dev/stdin >> $1
@@ -0,0 +1,151 @@
1
+ # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
2
+
3
+ require "test_helper"
4
+ require "ruby_git_hooks/jira_add_comment"
5
+
6
+ require "minitest/autorun"
7
+ require "rest-client"
8
+
9
+ class JiraCommentAddHookTest < HookTestCase
10
+ REPOS_DIR = File.expand_path File.join(File.dirname(__FILE__), "repos")
11
+
12
+ def setup
13
+ # NOTE- we can't just register a hook and do the commit and push
14
+ # for these tests because we need to mock the calls to
15
+ # RestClient to access Jira and the RubyGitHooks run in a separate process
16
+ # so the mocking won't work.
17
+
18
+ # Still create the repos and do the commits in order to get valid commit IDs
19
+ # for when we do the check directly
20
+
21
+ # Empty out the test repos dir
22
+ Hook.shell! "rm -rf #{File.join(REPOS_DIR, "*")}"
23
+ # Create local parent and child repos with a single shared commit
24
+ Dir.chdir REPOS_DIR
25
+
26
+ new_bare_repo
27
+ clone_repo
28
+ new_commit "child_repo", "README"
29
+ git_push
30
+ # add_hook("parent_repo.git", "post-receive", TEST_HOOK) # can't do this
31
+ @hook = JiraCommentAddHook.new "host" => "jira.example.com",
32
+ "username" => "user", "password" => "password"
33
+ end
34
+
35
+ def fake_hook_check(msg = "Commit message")
36
+ new_commit("child_repo", "file.txt","Contents", msg)
37
+ stub(@hook).commit_message { msg }
38
+ sha = last_commit_sha("child_repo")
39
+ stub(@hook).commits{[sha]}
40
+ Dir.chdir("child_repo") do
41
+ @hook.check
42
+ end
43
+ end
44
+
45
+ def test_no_reference_to_jira
46
+
47
+ dont_allow(JiraCommentAddHook).get_comment_content # check that no comment text is prepared
48
+ # because there are no tickets
49
+ fake_hook_check("No reference to Jira")
50
+ # will raise error if get_comment_content is called
51
+ end
52
+
53
+ def test_malformed_reference
54
+ dont_allow(JiraCommentAddHook).get_comment_content # check that no comment text is prepared
55
+ # because there are no tickets
56
+ fake_hook_check( "Incorrect reference to JiraJIRA-123" )
57
+ # will raise error if get_comment_content is called
58
+ end
59
+
60
+
61
+ def test_bad_reference
62
+ dont_allow(JiraCommentAddHook).add_comment # check that no comments are added
63
+ # because there are no valid tickets
64
+ mock(RestClient).get("https://user:password@jira.example.com/rest/api/latest/issue/BAD-234") do
65
+ exc = RestClient::Exception.new
66
+ mock(exc).http_code.at_least(1) { 404 }
67
+ raise exc
68
+ end
69
+
70
+ fake_hook_check("Message with BAD-234 reference to Jira" )
71
+
72
+ # will raise error if add_comment is called
73
+
74
+ end
75
+
76
+
77
+ def test_good_reference
78
+ mock(RestClient).get("https://user:password@jira.example.com/rest/api/latest/issue/GOOD-234") { <<JSON }
79
+ { "fields": { "status": { "name": "Open" } } }
80
+ JSON
81
+
82
+ mock(RestClient).post.with_any_args {<<JSON } # more complicated to check the args, just be sure it's called.
83
+ { "fields": { "status": { "name": "Open" } } }
84
+ JSON
85
+
86
+ fake_hook_check("Message with GOOD-234 reference to Jira" )
87
+
88
+ # as long as the mocked RestClient calls happen, we succeeded
89
+ end
90
+
91
+
92
+ def test_multiple_references_with_good
93
+ mock(RestClient).get("https://user:password@jira.example.com/rest/api/latest/issue/GOOD-234") { <<JSON }
94
+ { "fields": { "status": { "name": "Open" } } }
95
+ JSON
96
+ mock(RestClient).get("https://user:password@jira.example.com/rest/api/latest/issue/BAD-456") do
97
+ exc = RestClient::Exception.new
98
+ mock(exc).http_code.at_least(1) { 404 }
99
+ raise exc
100
+ end
101
+ mock(RestClient).get("https://user:password@jira.example.com/rest/api/latest/issue/NOT-123") do
102
+ exc = RestClient::Exception.new
103
+ mock(exc).http_code.at_least(1) { 404 }
104
+ raise exc
105
+ end
106
+ mock(RestClient).get("https://user:password@jira.example.com/rest/api/latest/issue/CLOSE-123") { <<JSON }
107
+ { "fields": { "status": { "name": "Closed" } } }
108
+ JSON
109
+
110
+ mock(RestClient).post.with_any_args {<<JSON } # more complicated to check the args, just be sure it's called.
111
+ { "fields": { "status": { "name": "Open" } } }
112
+ JSON
113
+
114
+ fake_hook_check("Message with CLOSE-123 BAD-456 GOOD-234 NOT-123 reference to Jira" )
115
+
116
+
117
+ end
118
+
119
+ def test_multiple_references_none_good
120
+ dont_allow(JiraCommentAddHook).add_comment # check that no comments are added
121
+ # because there are no valid tickets
122
+ mock(RestClient).get("https://user:password@jira.example.com/rest/api/latest/issue/BAD-456") do
123
+ exc = RestClient::Exception.new
124
+ mock(exc).http_code.at_least(1) { 404 }
125
+ raise exc
126
+ end
127
+ mock(RestClient).get("https://user:password@jira.example.com/rest/api/latest/issue/CLOSE-123") { <<JSON }
128
+ { "fields": { "status": { "name": "Closed" } } }
129
+ JSON
130
+ fake_hook_check("Message with CLOSE-123 BAD-456 reference to Jira" )
131
+ end
132
+
133
+
134
+ def test_closed_ok_when_not_checking
135
+ @hook = JiraCommentAddHook.new "check_status" => false, "host" => "jira.example.com",
136
+ "username" => "user", "password" => "password"
137
+
138
+ mock(RestClient).get("https://user:password@jira.example.com/rest/api/latest/issue/CLOSE-123") { <<JSON }
139
+ { "fields": { "status": { "name": "Closed" } } }
140
+ JSON
141
+ mock(RestClient).post.with_any_args {<<JSON } # more complicated to check the args, just be sure it's called.
142
+ { "fields": { "status": { "name": "Open" } } }
143
+ JSON
144
+
145
+ fake_hook_check("Message with CLOSE-123 don't check if closed reference to Jira" )
146
+
147
+
148
+ end
149
+
150
+
151
+ end
@@ -0,0 +1,37 @@
1
+ # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
2
+
3
+ require "test_helper"
4
+ require "ruby_git_hooks/jira_ref_check"
5
+
6
+ require "minitest/autorun"
7
+
8
+ class JiraReferenceCheckHookTest < HookTestCase
9
+ def setup
10
+ @hook = JiraReferenceCheckHook.new
11
+ end
12
+
13
+ def test_no_reference_to_jira
14
+ mock(@hook).commit_message.at_least(1) { "No reference to Jira" }
15
+
16
+ assert_equal false, @hook.check
17
+ end
18
+
19
+ def test_malformed_reference
20
+ mock(@hook).commit_message.at_least(1) { "Incorrect reference to JiraJIRA-123" }
21
+
22
+ assert_equal false, @hook.check
23
+ end
24
+
25
+ def test_good_reference
26
+ mock(@hook).commit_message.at_least(1) { "Message with GOOD-234 reference to Jira" }
27
+
28
+ assert_equal true, @hook.check
29
+ end
30
+
31
+ def test_multiple_references_with_good
32
+ mock(@hook).commit_message.at_least(1) { "Message with CLOSE-123 BAD-456 GOOD-234 NOT-123 reference to Jira" }
33
+ assert_equal true, @hook.check
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,52 @@
1
+ # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
2
+
3
+ require "test_helper"
4
+
5
+ require "minitest/autorun"
6
+
7
+ class MaxFileSizeHookTest < HookTestCase
8
+ REPOS_DIR = File.expand_path File.join(File.dirname(__FILE__), "repos")
9
+ MAX_SIZE = 100000
10
+ TEST_HOOK_BODY = <<TEST
11
+ #{RubyGitHooks.shebang}
12
+ require "ruby_git_hooks/max_file_size"
13
+
14
+ RubyGitHooks.run MaxFileSizeHook.new(MAX_SIZE)
15
+ TEST
16
+
17
+ def setup
18
+ # Empty out the test repos dir
19
+ Hook.shell! "rm -rf #{File.join(REPOS_DIR, "*")}"
20
+
21
+ # Create local parent and child repos with a single shared commit
22
+ Dir.chdir REPOS_DIR
23
+
24
+ new_bare_repo
25
+ clone_repo
26
+ new_commit "child_repo", "README"
27
+ git_push
28
+ end
29
+
30
+ def test_max_file_size_pre_receive
31
+ add_hook("parent_repo.git", "pre-receive", TEST_HOOK_BODY)
32
+ filename = "#{REPOS_DIR}/child_repo/BigFile.txt"
33
+
34
+ File.open(filename, "w") do |f|
35
+ alphanum = [('a'..'z'),('A'..'Z'),('0'..'9')].map{|i| i.to_a}.flatten
36
+ string = (0...MAX_SIZE*2).map{ alphanum[rand(alphanum.length)] }.join
37
+ f.write(string)
38
+ end
39
+ new_commit "child_repo", "BigFile.txt", nil
40
+
41
+ # Should reject w/ pre-commit hook
42
+ assert_raises RuntimeError do
43
+ git_push
44
+ end
45
+ end
46
+
47
+
48
+ #def test_case_clash_pre_commit
49
+ # add_hook("parent_repo.git", "pre-receive", TEST_HOOK_BODY)
50
+ #end
51
+
52
+ end
@@ -0,0 +1,77 @@
1
+ # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
2
+
3
+ require "test_helper"
4
+
5
+ require "minitest/autorun"
6
+
7
+ class CopyrightCheckHookTest < HookTestCase
8
+ REPOS_DIR = File.expand_path File.join(File.dirname(__FILE__), "repos")
9
+ TEST_HOOK_MULTI_REG = <<TEST
10
+ #{RubyGitHooks.shebang}
11
+ require "ruby_git_hooks/ruby_debug"
12
+ require "ruby_git_hooks/copyright_check"
13
+
14
+ RubyGitHooks.register RubyDebugHook.new
15
+ RubyGitHooks.register CopyrightCheckHook.new("no_send" => true)
16
+
17
+ RubyGitHooks.run
18
+ TEST
19
+
20
+ TEST_HOOK_MULTI_RUN = <<TEST
21
+ #{RubyGitHooks.shebang}
22
+ require "ruby_git_hooks/ruby_debug"
23
+ require "ruby_git_hooks/copyright_check"
24
+
25
+ RubyGitHooks.run RubyDebugHook.new,
26
+ CopyrightCheckHook.new("no_send" => true)
27
+ TEST
28
+
29
+ def setup
30
+ # Empty out the test repos dir
31
+ Hook.shell! "rm -rf #{File.join(REPOS_DIR, "*")}"
32
+
33
+ # Create local parent and child repos with a single shared commit
34
+ Dir.chdir REPOS_DIR
35
+
36
+ new_bare_repo
37
+ clone_repo
38
+ new_commit "child_repo", "README"
39
+ git_push
40
+ end
41
+
42
+ def test_multi_reg_pre_commit
43
+ add_hook("child_repo", "pre-commit", TEST_HOOK_MULTI_REG)
44
+
45
+ last_sha = last_commit_sha
46
+
47
+ new_commit("child_repo", "myfile.rb", <<FILE_CONTENTS)
48
+ # Copyright (C) 2013 YoyoDyne, Inc. All Rights Reserved.
49
+ # No copyright notice, no ruby-debug. Should be fine.
50
+ FILE_CONTENTS
51
+
52
+ assert last_sha != last_commit_sha,
53
+ "Multiple pre-commit should accept legal commit."
54
+ last_sha = last_commit_sha # update
55
+
56
+ assert_raises RuntimeError do
57
+ new_commit("child_repo", "myfile.rb", <<FILE_CONTENTS)
58
+ # No copyright notice, but no ruby-debug
59
+ FILE_CONTENTS
60
+ end
61
+
62
+ assert_equal last_sha, last_commit_sha,
63
+ "Multiple pre-commit should refuse illegal commit (1)."
64
+
65
+ assert_raises RuntimeError do
66
+ new_commit("child_repo", "myfile.rb", <<FILE_CONTENTS)
67
+ # Includes a copyright notice, but has ruby-debug
68
+ # Copyright (C) 2013 YoyoDyne, Inc. All Rights Reserved.
69
+ require 'ruby-debug'
70
+ FILE_CONTENTS
71
+ end
72
+
73
+ assert_equal last_sha, last_commit_sha,
74
+ "Multiple pre-commit should refuse illegal commit (2)."
75
+
76
+ end
77
+ end
@@ -0,0 +1,47 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
3
+
4
+ require "test_helper"
5
+
6
+ require "minitest/autorun"
7
+
8
+ class NonAsciiHookTest < HookTestCase
9
+ REPOS_DIR = File.expand_path File.join(File.dirname(__FILE__), "repos")
10
+ FAKE_CURL = File.expand_path File.join(File.dirname(__FILE__), "fake_curl")
11
+ TEST_HOOK_BODY = <<TEST
12
+ #{RubyGitHooks.shebang}
13
+ require "ruby_git_hooks/non_ascii"
14
+
15
+ RubyGitHooks.run NonAsciiCharactersCheckHook.new
16
+ TEST
17
+
18
+ def setup
19
+ # Empty out the test repos dir
20
+ Hook.shell! "rm -rf #{File.join(REPOS_DIR, "*")}"
21
+
22
+ # Create local parent and child repos with a single shared commit
23
+ Dir.chdir REPOS_DIR
24
+
25
+ new_bare_repo
26
+ clone_repo
27
+ new_commit "child_repo", "README"
28
+ git_push
29
+ end
30
+
31
+ def test_non_ascii_commit_msg
32
+ add_hook("child_repo", "commit-msg", TEST_HOOK_BODY)
33
+
34
+ assert_raises RuntimeError do
35
+ new_commit "child_repo", "test1", "Contents", "Hello this a mixed string © that I made.\nнельзя писать в коммит сообщение по русски"
36
+ end
37
+
38
+ # This should succeed
39
+ new_commit "child_repo", "test2", "GoodContents", "Nice and warm non-ascii message"
40
+
41
+ end
42
+
43
+ #def test_case_clash_pre_commit
44
+ # add_hook("parent_repo.git", "pre-receive", TEST_HOOK_BODY)
45
+ #end
46
+
47
+ end
data/test/repos/.keep ADDED
File without changes
@@ -0,0 +1,17 @@
1
+ # Copyright (C) 2013 OL2, Inc. See LICENSE.txt for details.
2
+
3
+ # Test local copy first
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
+
6
+ require "minitest/pride"
7
+ require "rr"
8
+
9
+ require "ruby_git_hooks"
10
+ require "ruby_git_hooks/git_ops"
11
+
12
+ class HookTestCase < MiniTest::Unit::TestCase
13
+ Hook = RubyGitHooks::Hook
14
+ include RubyGitHooks::GitOps
15
+
16
+ include RR::Adapters::MiniTest
17
+ end
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+ require "test_helper"
3
+
4
+ require "minitest/autorun"
5
+
6
+ class AddWatermarkHookTest < HookTestCase
7
+ REPOS_DIR = File.expand_path File.join(File.dirname(__FILE__), "repos")
8
+ FAKE_CURL = File.expand_path File.join(File.dirname(__FILE__), "fake_curl")
9
+ TEST_HOOK_BODY = <<TEST
10
+ #{RubyGitHooks.shebang}
11
+ require "ruby_git_hooks/watermark"
12
+
13
+ RubyGitHooks.run AddWatermarkCommitHook.new("WATERMARK")
14
+ TEST
15
+
16
+ def setup
17
+ # Empty out the test repos dir
18
+ Hook.shell! "rm -rf #{File.join(REPOS_DIR, "*")}"
19
+
20
+ # Create local parent and child repos with a single shared commit
21
+ Dir.chdir REPOS_DIR
22
+
23
+ new_bare_repo
24
+ clone_repo
25
+ new_commit "child_repo", "README"
26
+ git_push
27
+ end
28
+
29
+ def test_commit_has_watermark
30
+ add_hook("child_repo", "commit-msg", TEST_HOOK_BODY)
31
+
32
+ # This should succeed
33
+ new_commit "child_repo", "test2", "GoodContents", "Commit message"
34
+ msg = last_commit_message ("child_repo")
35
+ assert msg =~/WATERMARK/
36
+ end
37
+
38
+
39
+ end