def test_no_patch_mainline_for_kabi(self): text = """ From: [email protected] Subject: some patch References: FATE#123456 Acked-by: [email protected] """ self.header = header.Checker(text, False, "patches.kabi/FATE123456_fix_kabi.patch")
def test_patch_mainline_version_correct_from(self): text = """ From: [email protected] Subject: some patch Patch-mainline: v4.2-rc1 Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa References: bsc#12345 """ self.header = header.Checker(text)
def test_patch_mainline_submitted_correct_url(self): text = """ From: [email protected] Subject: some patch Patch-mainline: Submitted, https://lkml.org/archive/link-to-post References: bsc#12345 Acked-by: [email protected] """ errors = self.header = header.Checker(text)
def test_patch_mainline_not_yet_detail(self): text = """ From: [email protected] Subject: some patch Patch-mainline: Not yet, rare reason References: bsc#12345 Acked-by: [email protected] """ self.header = header.Checker(text)
def test_patch_references_missing_update(self): text = """ From: [email protected] Subject: some patch Patch-mainline: v4.2-rc1 Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Acked-by: [email protected] """ self.header = header.Checker(text, True)
def test_patch_mainline_no_detail(self): text = """ From: [email protected] Subject: some patch Patch-mainline: No, handled differently upstream References: bsc#12345 Acked-by: [email protected] """ self.header = header.Checker(text)
def test_patch_mainline_submitted_correct_ml(self): text = """ From: [email protected] Subject: some patch Patch-mainline: Submitted, 19 July 2015 - linux-btrfs References: bsc#12345 Acked-by: [email protected] """ errors = self.header = header.Checker(text)
def test_patch_mainline_never_detail(self): text = """ From: [email protected] Subject: some patch Patch-mainline: Never, SLES-specific feature References: FATE#123456 Acked-by: [email protected] """ self.header = header.Checker(text)
def test_empty(self): try: self.header = header.Checker("") except header.HeaderException as e: self.assertEqual(4, e.errors(header.MissingTagError)) self.assertTrue(e.tag_is_missing('patch-mainline')) self.assertTrue(e.tag_is_missing('from')) self.assertTrue(e.tag_is_missing('subject')) self.assertTrue(e.tag_is_missing('references')) self.assertEqual(4, e.errors())
def test_patch_references_multi3(self): text = """ From: [email protected] Subject: some patch Patch-mainline: v4.2-rc1 Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa References: bsc#12345, bsc#12354 Acked-by: [email protected] """ self.header = header.Checker(text)
def test_patch_mainline_version_correct_multi_ack(self): text = """ From: [email protected] Subject: some patch Patch-mainline: v4.2-rc1 Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa References: bsc#12345 Acked-by: [email protected] Acked-by: [email protected] """ self.header = header.Checker(text)
def test_patch_mainline_queued_correct(self): text = """ From: [email protected] Subject: some patch Patch-mainline: Queued Git-repo: git://path/to/git/repo Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa References: bsc#12345 Acked-by: [email protected] """ self.header = header.Checker(text)
def test_patch_mainline_never_no_detail(self): text = """ From: [email protected] Subject: some patch Patch-mainline: Never References: bsc#12345 Acked-by: [email protected] """ try: self.header = header.Checker(text) except header.HeaderException as e: self.assertEqual(1, e.errors(header.FormatError)) self.assertEqual(1, e.errors())
def test_patch_mainline_invalid(self): text = """ From: [email protected] Subject: some patch Patch-mainline: n/a References: bsc#12345 Acked-by: [email protected] """ with self.assertRaises(header.HeaderException) as cm: self.header = header.Checker(text) e = cm.exception self.assertEqual(1, e.errors(header.FormatError)) self.assertEqual(1, e.errors())
def test_patch_mainline_yes_with_detail(self): text = """ From: [email protected] Subject: some patch Patch-mainline: Yes, v4.1-rc1 References: bsc#12345 Acked-by: [email protected] """ try: self.header = header.Checker(text) self.assertTrue(False) except header.HeaderException, e: self.assertTrue(e.errors(header.FormatError) == 1) self.assertTrue(e.errors() == 1)
def test_diff_like_description2(self): text = """ From: [email protected] Subject: blablah Patch-mainline: v4.2-rc1 Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa References: bsc#12345 This is a thing. I ran across it: --- Testing resulted in failure Acked-by: [email protected] """ self.header = header.Checker(text)
def test_patch_mainline_invalid(self): text = """ From: [email protected] Subject: some patch Patch-mainline: n/a References: bsc#12345 Acked-by: [email protected] """ try: self.header = header.Checker(text) self.assertTrue(False) except header.HeaderException as e: self.assertTrue(e.errors(header.FormatError) == 1) self.assertTrue(e.errors() == 1)
def test_patch_references_empty_update(self): text = """ From: [email protected] Subject: some patch Patch-mainline: v4.2-rc1 Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa References: Acked-by: [email protected] """ with self.assertRaises(header.HeaderException) as cm: self.header = header.Checker(text, True) e = cm.exception self.assertEqual(1, e.errors(header.EmptyTagError)) self.assertEqual(1, e.errors())
def test_patch_references_missing(self): text = """ From: [email protected] Subject: some patch Patch-mainline: v4.2-rc1 Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Acked-by: [email protected] """ try: self.header = header.Checker(text) self.assertTrue(False) except header.HeaderException as e: self.assertTrue(e.errors(header.MissingTagError) == 1) self.assertTrue(e.tag_is_missing('references')) self.assertTrue(e.errors() == 1)
def test_patch_references_missing(self): text = """ From: [email protected] Subject: some patch Patch-mainline: v4.2-rc1 Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa Acked-by: [email protected] """ with self.assertRaises(header.HeaderException) as cm: self.header = header.Checker(text) e = cm.exception self.assertEqual(1, e.errors(header.MissingTagError)) self.assertTrue(e.tag_is_missing('references')) self.assertEqual(1, e.errors())
def test_subject_dupe(self): text = """ From: [email protected] Subject: some patch Subject: some patch Patch-mainline: v4.2-rc2 Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa References: bsc#12345 Acked-by: [email protected] """ with self.assertRaises(header.HeaderException) as cm: self.header = header.Checker(text) e = cm.exception self.assertEqual(1, e.errors(header.DuplicateTagError)) self.assertEqual(1, e.errors())
def test_patch_mainline_submitted_detail_git_commit(self): text = """ From: [email protected] Subject: some patch Patch-mainline: Submitted, https://lkml.org/archive/link-to-post Git-repo: git://host/valid/path/to/repo References: bsc#12345 Acked-by: [email protected] """ with self.assertRaises(header.HeaderException) as cm: self.header = header.Checker(text) e = cm.exception self.assertEqual(1, e.errors(header.ExcludedTagError)) self.assertEqual(1, e.errors())
def test_git_commit_standalone(self): text = """ From: [email protected] Subject: some patch Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa References: bsc#12345 Acked-by: [email protected] """ try: self.header = header.Checker(text) except header.HeaderException as e: # Both policy and Git-commit require Patch-mainline self.assertEqual(2, e.errors(header.MissingTagError)) self.assertTrue(e.tag_is_missing('patch-mainline')) self.assertEqual(2, e.errors())
def test_patch_references_empty_update(self): text = """ From: [email protected] Subject: some patch Patch-mainline: v4.2-rc1 Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa References: Acked-by: [email protected] """ try: self.header = header.Checker(text, True) self.assertTrue(False) except header.HeaderException as e: self.assertTrue(e.errors(header.EmptyTagError) == 1) self.assertTrue(e.errors() == 1)
def test_patch_mainline_submitted_detail_git_commit(self): text = """ From: [email protected] Subject: some patch Patch-mainline: Submitted, https://lkml.org/archive/link-to-post Git-repo: git://host/valid/path/to/repo References: bsc#12345 Acked-by: [email protected] """ try: self.header = header.Checker(text) self.assertTrue(False) except header.HeaderException as e: self.assertTrue(e.errors(header.ExcludedTagError) == 1) self.assertTrue(e.errors() == 1)
def test_patch_mainline_empty(self): text = """ From: [email protected] Subject: some patch Patch-mainline: References: bsc#12345 Acked-by: [email protected] """ try: self.header = header.Checker(text) self.assertTrue(False) except header.HeaderException as e: self.assertTrue(e.errors(header.EmptyTagError) == 1) self.assertTrue(e.errors(header.MissingTagError) == 1) self.assertTrue(e.tag_is_missing('patch-mainline')) self.assertTrue(e.errors() == 2)
def test_patch_mainline_version_no_ack_or_sob(self): text = """ From: [email protected] Subject: some patch Patch-mainline: v4.2-rc1 References: bsc#12345 Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa """ try: self.header = header.Checker(text) except header.HeaderException as e: self.assertEqual(1, e.errors(header.MissingTagError)) self.assertTrue(e.tag_is_missing('acked-by')) self.assertTrue(e.tag_is_missing('signed-off-by')) self.assertEqual(1, e.errors())
def test_patch_mainline_dupe(self): text = """ From: [email protected] Subject: some patch Patch-mainline: v4.2-rc1 Patch-mainline: v4.2-rc2 Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa References: bsc#12345 Acked-by: [email protected] """ try: self.header = header.Checker(text) self.assertTrue(False) except header.HeaderException as e: self.assertTrue(e.errors(header.DuplicateTagError) == 1) self.assertTrue(e.errors() == 1)
def test_patch_mainline_empty(self): text = """ From: [email protected] Subject: some patch Patch-mainline: References: bsc#12345 Acked-by: [email protected] """ with self.assertRaises(header.HeaderException) as cm: self.header = header.Checker(text) e = cm.exception self.assertEqual(1, e.errors(header.EmptyTagError)) self.assertEqual(1, e.errors(header.MissingTagError)) self.assertTrue(e.tag_is_missing('patch-mainline')) self.assertEqual(2, e.errors())
def test_patch_mainline_queued_with_git_commit(self): text = """ From: [email protected] Subject: some patch Patch-mainline: Queued Git-commit: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa References: bsc#12345 Acked-by: [email protected] """ with self.assertRaises(header.HeaderException) as cm: self.header = header.Checker(text) e = cm.exception self.assertEqual(1, e.errors(header.MissingTagError)) self.assertTrue(e.tag_is_missing('git-repo')) self.assertEqual(1, e.errors())