| 241 | expect(mk(('pull_request_review', 'submitted', {'sender': {'login': 'a'}})), {'a'}) |
| 242 | |
| 243 | def test_approvers(self): |
| 244 | def expect(comment, result): |
| 245 | self.assertEqual(result, classifier.get_approvers([{ |
| 246 | 'author': 'k8s-merge-robot', 'comment': comment}])) |
| 247 | |
| 248 | expect('nothing', []) |
| 249 | expect('before\n<!-- META={approvers:[someone]} -->', ['someone']) |
| 250 | expect('<!-- META={approvers:[someone,else]} -->', ['someone', 'else']) |
| 251 | expect('<!-- META={approvers:[someone,else]} -->', ['someone', 'else']) |
| 252 | |
| 253 | # The META format is *supposed* to be JSON, but a recent change broke it. |
| 254 | # Support both formats so it can be fixed in the future. |
| 255 | expect('<!-- META={"approvers":["username"]} -->\n', ['username']) |
| 256 | |
| 257 | |
| 258 | class CommentsTest(unittest.TestCase): |