示例#1
0
 def test_no_message(self):
     errors = check_message("", **self.options)
     assert_that(
         errors,
         has_items("1: M110 missing component name",
                   "1: M101 signature is missing",
                   "1: M100 needs more reviewers"))
示例#2
0
 def test_using_alternative_bullet_character(self):
     errors = check_message("search: hello\r\n\r\n"
                            "- bullet 1\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>",
                            **self.options)
     assert_that(errors,
                 has_item("3: M102 unrecognized bullet/signature"))
示例#3
0
 def test_using_alternative_bullet_character(self):
     errors = check_message("search: hello\r\n\r\n"
                            "- bullet 1\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>",
                            **self.options)
     assert_that(errors,
                 has_item("3: M102 unrecognized bullet/signature"))
示例#4
0
 def test_no_component_name(self):
     errors = check_message("foo bar.", **self.options)
     assert_that(errors,
                 has_items("1: M110 missing component name",
                           "1: M101 signature is missing",
                           "1: M100 needs more reviewers",
                           "1: M191 must not end with a dot '.'"))
示例#5
0
 def test_no_component_name(self):
     errors = check_message("foo bar.", **self.options)
     assert_that(errors,
                 has_items("1: M110 missing component name",
                           "1: M101 signature is missing",
                           "1: M100 needs more reviewers",
                           "1: M191 must not end with a dot '.'"))
示例#6
0
 def test_has_enough_reviewers(self):
     errors = check_message("search: hello\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>\r\n"
                            "Reviewed-by: b b <*****@*****.**>\r\n"
                            "Reviewed-by: c c <*****@*****.**>\r\n"
                            "Reported-by: d d <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_length(0))
示例#7
0
 def test_valid_bullets(self):
     errors = check_message("search: hello\r\n\r\n"
                            "* bullet 1\r\n\r\n"
                            "* bullet 2\r\n\r\n"
                            "* bullet 3\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_length(0))
示例#8
0
 def test_valid_bullets(self):
     errors = check_message("search: hello\r\n\r\n"
                            "* bullet 1.\r\n\r\n"
                            "* bullet 2.\r\n\r\n"
                            "* bullet 3.\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_length(0))
示例#9
0
 def test_has_enough_reviewers(self):
     errors = check_message("search: hello\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>\r\n"
                            "Reviewed-by: b b <*****@*****.**>\r\n"
                            "Reviewed-by: c c <*****@*****.**>\r\n"
                            "Reported-by: d d <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_length(0))
示例#10
0
 def test_valid_multiline_bullets(self):
     errors = check_message("search: hello\r\n\r\n"
                            "* bullet 1\r\n"
                            "  lorem ipsum.\r\n\r\n"
                            "* bullet 2\r\n"
                            "  dolor sit amet.\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_length(0))
示例#11
0
 def test_missing_empty_line_before_bullet(self):
     errors = check_message("search: hello\r\n"
                            "* bullet 1.\r\n\r\n"
                            "* bullet 2.\r\n"
                            "* bullet 3.\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_length(3))
     assert_that(errors,
                 has_items("2: M120 missing empty line before bullet",
                           "5: M120 missing empty line before bullet"))
示例#12
0
 def test_line_is_too_long(self):
     # max is 72 total including the identation
     too_long = "".join(list(repeat("M", 70)))
     errors = check_message(
         "search: hello\r\n\r\n"
         "* {0}\r\n\r\n"
         "* M{0}\r\n\r\n"
         "Signed-off-by: a a <*****@*****.**>".format(too_long),
         **self.options)
     assert_that(errors, has_length(1))
     assert_that(errors, has_item("5: M190 line is too long (73 > 72)"))
示例#13
0
 def test_missing_empty_line_before_bullet(self):
     errors = check_message("search: hello\r\n"
                            "* bullet 1\r\n\r\n"
                            "* bullet 2\r\n"
                            "* bullet 3\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_length(3))
     assert_that(errors,
                 has_items("2: M120 missing empty line before bullet",
                           "5: M120 missing empty line before bullet"))
示例#14
0
 def test_line_is_too_long(self):
     # max is 72 total including the identation
     too_long = "".join(list(repeat("M", 70)))
     errors = check_message("search: hello\r\n\r\n"
                            "* {0}\r\n\r\n"
                            "* M{0}\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>"
                            .format(too_long),
                            **self.options)
     assert_that(errors, has_length(1))
     assert_that(errors,
                 has_item("5: M190 line is too long (73 > 72)"))
示例#15
0
 def test_signatures_mixed_with_bullets(self):
     errors = check_message("search: hello\r\n\r\n"
                            "* bullet 1\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>\r\n\r\n"
                            "* bullet 2\r\n\r\n"
                            "Reviewed-by: b b <*****@*****.**>\r\n\r\n"
                            "* bullet 3\r\n\r\n"
                            "Reviewed-by: c c <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_items(
         "7: M130 no bullets are allowed after signatures",
         "11: M130 no bullets are allowed after signatures"))
示例#16
0
 def test_bullet_labels(self):
     errors = check_message("search: hello\r\n\r\n"
                            "* NEW bullet 1\r\n  line 2\r\n\r\n"
                            "* AMENDS deadbeef\r\n\r\n"
                            "* DEADBEEF invalid name\r\n\r\n"
                            "* MISSINGSPACE\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>\r\n\r\n"
                            "Reviewed-by: b b <*****@*****.**>\r\n\r\n"
                            "Reviewed-by: c c <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_items(
         "8: M122 unrecognized bullet label: DEADBEEF"))
示例#17
0
 def test_signatures_mixed_with_bullets(self):
     errors = check_message("search: hello\r\n\r\n"
                            "* bullet 1\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>\r\n\r\n"
                            "* bullet 2\r\n\r\n"
                            "Reviewed-by: b b <*****@*****.**>\r\n\r\n"
                            "* bullet 3\r\n\r\n"
                            "Reviewed-by: c c <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_items(
         "7: M130 no bullets are allowed after signatures",
         "11: M130 no bullets are allowed after signatures"))
示例#18
0
 def test_bullet_labels(self):
     errors = check_message("search: hello\r\n\r\n"
                            "* NEW bullet 1\r\n  line 2\r\n\r\n"
                            "* AMENDS deadbeef\r\n\r\n"
                            "* DEADBEEF invalid name\r\n\r\n"
                            "* MISSINGSPACE\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>\r\n\r\n"
                            "Reviewed-by: b b <*****@*****.**>\r\n\r\n"
                            "Reviewed-by: c c <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_items(
         "8: M122 unrecognized bullet label: DEADBEEF"))
示例#19
0
 def test_wrong_identation_after_bullet(self):
     errors = check_message("search: hello\r\n\r\n"
                            "* line 1\r\n"
                            "line 2\r\n"
                            " line 3\r\n"
                            "  line 4\r\n"
                            "   line 5\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>",
                            **self.options)
     assert_that(errors,
                 has_items("4: M121 indentation of two spaces expected",
                           "5: M121 indentation of two spaces expected",
                           "7: M121 indentation of two spaces expected"))
     assert_that(errors,
                 is_not(has_item("M121: 6: indentation of two spaces "
                                 "expected")))
示例#20
0
 def test_wrong_identation_after_bullet(self):
     errors = check_message("search: hello\r\n\r\n"
                            "* line 1\r\n"
                            "line 2\r\n"
                            " line 3\r\n"
                            "  line 4\r\n"
                            "   line 5\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>",
                            **self.options)
     assert_that(errors,
                 has_items("4: M121 indentation of two spaces expected",
                           "5: M121 indentation of two spaces expected",
                           "7: M121 indentation of two spaces expected"))
     assert_that(errors,
                 is_not(has_item("M121: 6: indentation of two spaces "
                                 "expected")))
示例#21
0
 def test_missing_dots_in_bullets(self):
     errors = check_message("search: hello\r\n\r\n"
                            "* NEW bullet 1\r\n  line 2.\r\n\r\n"
                            "* NEW bullet 1\r\n  line 2\r\n\r\n"
                            "* bullet 1\r\n\r\n"
                            "* bullet 2.\r\n\r\n"
                            "* bullet 2. (closes #123)\r\n\r\n"
                            "* bullet 2 (closes #123)\r\n\r\n"
                            "* bullet 2. (addresses #543) (closes #123)\r\n\r\n"
                            "* bullet 2 (addresses #543) (closes #123)\r\n\r\n"
                            "* NEW bullet 1.\r\n  (closes #234)\r\n\r\n"
                            "* NEW bullet 1\r\n  (closes #234)\r\n\r\n",
                            **self.options)
     assert_that(errors, has_items(
         "6: M123 no dot at the end of the sentence",
         "9: M123 no dot at the end of the sentence",
         "15: M123 no dot at the end of the sentence",
         "19: M123 no dot at the end of the sentence",
         "24: M123 no dot at the end of the sentence",
     ))
示例#22
0
 def test_allow_empty_message(self):
     options = dict(self.options, allow_empty="True")
     errors = check_message("", **options)
     assert_that(errors, has_length(0))
示例#23
0
 def test_no_message(self):
     errors = check_message("", **self.options)
     assert_that(errors,
                 has_items("1: M110 missing component name",
                           "1: M101 signature is missing",
                           "1: M100 needs more reviewers"))
示例#24
0
 def test_first_line_is_too_long(self):
     message = "".join(repeat("M", 51))
     errors = check_message(message, **self.options)
     assert_that(errors, has_item("1: M190 line is too long (51 > 50)"))
示例#25
0
 def test_unknonwn_component_name(self):
     errors = check_message("kikoo: lol", **self.options)
     assert_that(errors,
                 has_item("1: M111 unrecognized component name: kikoo"))
示例#26
0
 def test_has_a_trusted_developer(self):
     errors = check_message("search: hello\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_length(0))
示例#27
0
 def test_signature_ends_with_a_dot(self):
     errors = check_message("search: hello\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>.",
                            **self.options)
     assert_that(errors, has_item("3: M191 must not end with a dot '.'"))
示例#28
0
 def test_allow_utf8_in_message(self):
     errors = check_message("search: hello\r\n\r\n"
                            "* Líščí.\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_length(0))
示例#29
0
 def test_known_component_name(self):
     errors = check_message("utils: foo bar", **self.options)
     assert_that(errors,
                 has_items("1: M101 signature is missing",
                           "1: M100 needs more reviewers"))
示例#30
0
 def test_known_component_name(self):
     errors = check_message("utils: foo bar", **self.options)
     assert_that(errors,
                 has_items("1: M101 signature is missing",
                           "1: M100 needs more reviewers"))
示例#31
0
 def test_unknonwn_component_name(self):
     errors = check_message("kikoo: lol", **self.options)
     assert_that(errors,
                 has_item("1: M111 unrecognized component name: kikoo"))
示例#32
0
 def test_first_line_is_too_long(self):
     message = "".join(repeat("M", 51))
     errors = check_message(message, **self.options)
     assert_that(errors, has_item("1: M190 line is too long (51 > 50)"))
示例#33
0
 def test_allow_empty_message(self):
     options = dict(self.options, allow_empty="True")
     errors = check_message("", **options)
     assert_that(errors, has_length(0))
示例#34
0
 def test_needs_more_reviewers(self):
     errors = check_message("search: hello\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_item("1: M100 needs more reviewers"))
示例#35
0
 def test_needs_more_reviewers(self):
     errors = check_message("search: hello\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_item("1: M100 needs more reviewers"))
示例#36
0
 def test_has_a_trusted_developer(self):
     errors = check_message("search: hello\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>",
                            **self.options)
     assert_that(errors, has_length(0))
示例#37
0
 def test_signature_ends_with_a_dot(self):
     errors = check_message("search: hello\r\n\r\n"
                            "Signed-off-by: a a <*****@*****.**>.",
                            **self.options)
     assert_that(errors, has_item("3: M191 must not end with a dot '.'"))