| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 from webkitpy.tool.bot.commitannouncer import CommitAnnouncer | 28 from webkitpy.tool.bot.commitannouncer import CommitAnnouncer |
| 29 from webkitpy.tool.mocktool import MockTool | 29 from webkitpy.tool.mocktool import MockTool |
| 30 | 30 |
| 31 | 31 |
| 32 class CommitAnnouncerTest(unittest.TestCase): | 32 class CommitAnnouncerTest(unittest.TestCase): |
| 33 def test_format_commit(self): | 33 def test_format_commit(self): |
| 34 tool = MockTool() | 34 tool = MockTool() |
| 35 bot = CommitAnnouncer(tool, "test_password") | 35 bot = CommitAnnouncer(tool, "test_password") |
| 36 self.assertEqual( | 36 self.assertEqual( |
| 37 'authorABC@chromium.org committed "Commit test subject line" ' | 37 'r456789 http://crrev.com/123456 authorABC@chromium.org committed "Co
mmit test subject line"', |
| 38 'http://crrev.com/123456 r456789', | |
| 39 bot._format_commit_detail("""\ | 38 bot._format_commit_detail("""\ |
| 40 1234commit1234 | 39 1234commit1234 |
| 41 authorABC@chromium.org | 40 authorABC@chromium.org |
| 42 Commit test subject line | 41 Commit test subject line |
| 43 Multiple | 42 Multiple |
| 44 lines | 43 lines |
| 45 of | 44 of |
| 46 description. | 45 description. |
| 47 | 46 |
| 48 BUG=654321 | 47 BUG=654321 |
| 49 | 48 |
| 50 Review URL: https://codereview.chromium.org/123456 | 49 Review URL: https://codereview.chromium.org/123456 |
| 51 | 50 |
| 52 git-svn-id: svn://svn.chromium.org/blink/trunk@456789 bbb929c8-8fbe-4397-9dbb-9b
2b20218538 | 51 git-svn-id: svn://svn.chromium.org/blink/trunk@456789 bbb929c8-8fbe-4397-9dbb-9b
2b20218538 |
| 53 """)) | 52 """)) |
| 54 | 53 |
| 55 self.assertEqual( | 54 self.assertEqual( |
| 56 'authorABC@chromium.org committed "Commit test subject line" ' | 55 'r456789 https://chromium.googlesource.com/chromium/blink/+/1234comm
' |
| 57 'https://chromium.googlesource.com/chromium/blink/+/1234comm ' | 56 'authorABC@chromium.org committed "Commit test subject line"', |
| 58 'r456789', | |
| 59 bot._format_commit_detail("""\ | 57 bot._format_commit_detail("""\ |
| 60 1234commit1234 | 58 1234commit1234 |
| 61 authorABC@chromium.org | 59 authorABC@chromium.org |
| 62 Commit test subject line | 60 Commit test subject line |
| 63 Multiple | 61 Multiple |
| 64 lines | 62 lines |
| 65 of | 63 of |
| 66 description. | 64 description. |
| 67 | 65 |
| 68 BUG=654321 | 66 BUG=654321 |
| 69 | 67 |
| 70 git-svn-id: svn://svn.chromium.org/blink/trunk@456789 bbb929c8-8fbe-4397-9dbb-9b
2b20218538 | 68 git-svn-id: svn://svn.chromium.org/blink/trunk@456789 bbb929c8-8fbe-4397-9dbb-9b
2b20218538 |
| 71 """)) | 69 """)) |
| 72 | 70 |
| 73 self.assertEqual( | 71 self.assertEqual( |
| 74 'authorABC@chromium.org committed "Commit test subject line" ' | 72 'http://crrev.com/123456 authorABC@chromium.org committed "Commit te
st subject line"', |
| 75 'http://crrev.com/123456 ', | |
| 76 bot._format_commit_detail("""\ | 73 bot._format_commit_detail("""\ |
| 77 1234commit1234 | 74 1234commit1234 |
| 78 authorABC@chromium.org | 75 authorABC@chromium.org |
| 79 Commit test subject line | 76 Commit test subject line |
| 80 Multiple | 77 Multiple |
| 81 lines | 78 lines |
| 82 of | 79 of |
| 83 description. | 80 description. |
| 84 | 81 |
| 85 BUG=654321 | 82 BUG=654321 |
| 86 | 83 |
| 87 Review URL: https://codereview.chromium.org/123456 | 84 Review URL: https://codereview.chromium.org/123456 |
| 88 """)) | 85 """)) |
| 89 | 86 |
| 90 self.assertEqual( | 87 self.assertEqual( |
| 91 'authorABC@chromium.org committed "Commit test subject line" ' | 88 'https://chromium.googlesource.com/chromium/blink/+/1234comm authorA
BC@chromium.org committed "Commit test subject line"', |
| 92 'https://chromium.googlesource.com/chromium/blink/+/1234comm ', | |
| 93 bot._format_commit_detail("""\ | 89 bot._format_commit_detail("""\ |
| 94 1234commit1234 | 90 1234commit1234 |
| 95 authorABC@chromium.org | 91 authorABC@chromium.org |
| 96 Commit test subject line | 92 Commit test subject line |
| 97 Multiple | 93 Multiple |
| 98 lines | 94 lines |
| 99 of | 95 of |
| 100 description. | 96 description. |
| 101 """)) | 97 """)) |
| 102 | 98 |
| 103 self.assertEqual( | 99 self.assertEqual( |
| 104 'authorABC@chromium.org committed "Commit test subject line" ' | 100 'r456789 http://crrev.com/123456 authorABC@chromium.org committed "C
ommit test subject line"', |
| 105 'http://crrev.com/123456 r456789', | |
| 106 bot._format_commit_detail("""\ | 101 bot._format_commit_detail("""\ |
| 107 1234commit1234 | 102 1234commit1234 |
| 108 authorABC@chromium.org | 103 authorABC@chromium.org |
| 109 Commit test subject line | 104 Commit test subject line |
| 110 Multiple | 105 Multiple |
| 111 lines | 106 lines |
| 112 of | 107 of |
| 113 description. | 108 description. |
| 114 Review URL: http://fake.review.url | 109 Review URL: http://fake.review.url |
| 115 git-svn-id: svn://svn.chromium.org/blink/trunk@000000 Fake-SVN-number | 110 git-svn-id: svn://svn.chromium.org/blink/trunk@000000 Fake-SVN-number |
| 116 | 111 |
| 117 BUG=654321 | 112 BUG=654321 |
| 118 | 113 |
| 119 Review URL: https://codereview.chromium.org/123456 | 114 Review URL: https://codereview.chromium.org/123456 |
| 120 | 115 |
| 121 git-svn-id: svn://svn.chromium.org/blink/trunk@456789 bbb929c8-8fbe-4397-9dbb-9b
2b20218538 | 116 git-svn-id: svn://svn.chromium.org/blink/trunk@456789 bbb929c8-8fbe-4397-9dbb-9b
2b20218538 |
| 122 """)) | 117 """)) |
| 123 | 118 |
| 124 self.assertEqual( | 119 self.assertEqual( |
| 125 'authorABC@chromium.org committed "Commit test subject line" ' | 120 'r456789 http://crrev.com/123456 authorABC@chromium.org committed "Co
mmit test subject line" ' |
| 126 'http://crrev.com/123456 r456789 ' | |
| 127 '\x037TBR=reviewerDEF@chromium.org\x03', | 121 '\x037TBR=reviewerDEF@chromium.org\x03', |
| 128 bot._format_commit_detail("""\ | 122 bot._format_commit_detail("""\ |
| 129 1234commit1234 | 123 1234commit1234 |
| 130 authorABC@chromium.org | 124 authorABC@chromium.org |
| 131 Commit test subject line | 125 Commit test subject line |
| 132 Multiple | 126 Multiple |
| 133 lines | 127 lines |
| 134 of | 128 of |
| 135 description. | 129 description. |
| 136 | 130 |
| 137 BUG=654321 | 131 BUG=654321 |
| 138 TBR=reviewerDEF@chromium.org | 132 TBR=reviewerDEF@chromium.org |
| 139 | 133 |
| 140 Review URL: https://codereview.chromium.org/123456 | 134 Review URL: https://codereview.chromium.org/123456 |
| 141 | 135 |
| 142 git-svn-id: svn://svn.chromium.org/blink/trunk@456789 bbb929c8-8fbe-4397-9dbb-9b
2b20218538 | 136 git-svn-id: svn://svn.chromium.org/blink/trunk@456789 bbb929c8-8fbe-4397-9dbb-9b
2b20218538 |
| 143 """)) | 137 """)) |
| 144 | 138 |
| 145 self.assertEqual( | 139 self.assertEqual( |
| 146 'authorABC@chromium.org committed "Commit test subject line" ' | 140 'r456789 http://crrev.com/123456 authorABC@chromium.org committed "Co
mmit test subject line" ' |
| 147 'http://crrev.com/123456 r456789 ' | |
| 148 '\x037NOTRY=true\x03', | 141 '\x037NOTRY=true\x03', |
| 149 bot._format_commit_detail("""\ | 142 bot._format_commit_detail("""\ |
| 150 1234commit1234 | 143 1234commit1234 |
| 151 authorABC@chromium.org | 144 authorABC@chromium.org |
| 152 Commit test subject line | 145 Commit test subject line |
| 153 Multiple | 146 Multiple |
| 154 lines | 147 lines |
| 155 of | 148 of |
| 156 description. | 149 description. |
| 157 | 150 |
| 158 BUG=654321 | 151 BUG=654321 |
| 159 NOTRY=true | 152 NOTRY=true |
| 160 | 153 |
| 161 Review URL: https://codereview.chromium.org/123456 | 154 Review URL: https://codereview.chromium.org/123456 |
| 162 | 155 |
| 163 git-svn-id: svn://svn.chromium.org/blink/trunk@456789 bbb929c8-8fbe-4397-9dbb-9b
2b20218538 | 156 git-svn-id: svn://svn.chromium.org/blink/trunk@456789 bbb929c8-8fbe-4397-9dbb-9b
2b20218538 |
| 164 """)) | 157 """)) |
| 165 | 158 |
| 166 self.assertEqual( | 159 self.assertEqual( |
| 167 'authorABC@chromium.org committed "Commit test subject line" ' | 160 'r456789 http://crrev.com/123456 authorABC@chromium.org committed "Co
mmit test subject line" ' |
| 168 'http://crrev.com/123456 r456789 ' | |
| 169 '\x037NOTRY=true TBR=reviewerDEF@chromium.org\x03', | 161 '\x037NOTRY=true TBR=reviewerDEF@chromium.org\x03', |
| 170 bot._format_commit_detail("""\ | 162 bot._format_commit_detail("""\ |
| 171 1234commit1234 | 163 1234commit1234 |
| 172 authorABC@chromium.org | 164 authorABC@chromium.org |
| 173 Commit test subject line | 165 Commit test subject line |
| 174 Multiple | 166 Multiple |
| 175 lines | 167 lines |
| 176 of | 168 of |
| 177 description. | 169 description. |
| 178 | 170 |
| 179 NOTRY=true | 171 NOTRY=true |
| 180 BUG=654321 | 172 BUG=654321 |
| 181 TBR=reviewerDEF@chromium.org | 173 TBR=reviewerDEF@chromium.org |
| 182 | 174 |
| 183 Review URL: https://codereview.chromium.org/123456 | 175 Review URL: https://codereview.chromium.org/123456 |
| 184 | 176 |
| 185 git-svn-id: svn://svn.chromium.org/blink/trunk@456789 bbb929c8-8fbe-4397-9dbb-9b
2b20218538 | 177 git-svn-id: svn://svn.chromium.org/blink/trunk@456789 bbb929c8-8fbe-4397-9dbb-9b
2b20218538 |
| 186 """)) | 178 """)) |
| 187 | 179 |
| 188 self.assertEqual( | 180 self.assertEqual( |
| 189 'authorABC@chromium.org committed "Commit test subject line" ' | 181 'r456789 http://crrev.com/123456 authorABC@chromium.org committed "Co
mmit test subject line" ' |
| 190 'http://crrev.com/123456 r456789 ' | |
| 191 '\x037tbr=reviewerDEF@chromium.org, reviewerGHI@chromium.org, reviewe
rJKL@chromium.org notry=TRUE\x03', | 182 '\x037tbr=reviewerDEF@chromium.org, reviewerGHI@chromium.org, reviewe
rJKL@chromium.org notry=TRUE\x03', |
| 192 bot._format_commit_detail("""\ | 183 bot._format_commit_detail("""\ |
| 193 1234commit1234 | 184 1234commit1234 |
| 194 authorABC@chromium.org | 185 authorABC@chromium.org |
| 195 Commit test subject line | 186 Commit test subject line |
| 196 Multiple | 187 Multiple |
| 197 lines | 188 lines |
| 198 of | 189 of |
| 199 description. | 190 description. |
| 200 | 191 |
| 201 BUG=654321 | 192 BUG=654321 |
| 202 tbr=reviewerDEF@chromium.org, reviewerGHI@chromium.org, reviewerJKL@chromium.org | 193 tbr=reviewerDEF@chromium.org, reviewerGHI@chromium.org, reviewerJKL@chromium.org |
| 203 notry=TRUE | 194 notry=TRUE |
| 204 | 195 |
| 205 Review URL: https://codereview.chromium.org/123456 | 196 Review URL: https://codereview.chromium.org/123456 |
| 206 | 197 |
| 207 git-svn-id: svn://svn.chromium.org/blink/trunk@456789 bbb929c8-8fbe-4397-9dbb-9b
2b20218538 | 198 git-svn-id: svn://svn.chromium.org/blink/trunk@456789 bbb929c8-8fbe-4397-9dbb-9b
2b20218538 |
| 208 """)) | 199 """)) |
| 209 | 200 |
| 210 def test_sanitize_string(self): | 201 def test_sanitize_string(self): |
| 211 bot = CommitAnnouncer(MockTool(), "test_password") | 202 bot = CommitAnnouncer(MockTool(), "test_password") |
| 212 self.assertEqual('normal ascii', bot._sanitize_string('normal ascii')) | 203 self.assertEqual('normal ascii', bot._sanitize_string('normal ascii')) |
| 213 self.assertEqual('uni\\u0441ode!', bot._sanitize_string(u'uni\u0441ode!'
)) | 204 self.assertEqual('uni\\u0441ode!', bot._sanitize_string(u'uni\u0441ode!'
)) |
| OLD | NEW |