fw4spl
test_check_commit.py
1 #!/usr/bin/env python2
2 # -*- coding: utf-8 -*-
3 
4 import unittest
5 
6 import check_commit
7 import common
8 
9 
10 class TestCheckCommit(unittest.TestCase):
11  def test_check_commit_with_valid_title(self):
12  # Be verbose by default
13  common.g_trace = True
14 
15  # Apply the hook
17  ["ffffffff:devil@ircad.fr:fix(reactor): Prevent uncontrolled nuclear fusion. See #666"])
18 
20  ["ffffffff:devil@ircad.fr:chore(*): apply latest sheldon"])
21 
23  ["ffffffff:devil@ircad.fr:refactor(plugin_config.cmake): generate at build instead at configure"])
24 
25  # Check result
26  self.assertFalse(any(result), "A valid commit has been detected as invalid.")
27 
28  def test_check_commit_with_invalid_title(self):
29  # Be verbose by default
30  common.g_trace = True
31 
32  # Apply the hook
34  ["ffffffff:devil@ircad.fr:It's the party at the village"])
35 
36  # Check result
37  self.assertTrue(any(result), "An invalid commit has not been detected as invalid")
38 
39  def test_check_commit_with_valid_author(self):
40  # Be verbose by default
41  common.g_trace = True
42 
43  # Apply the hook
45  ["ffffffff:god@ircad.fr:fix(reactor): Prevent uncontrolled nuclear fusion. See #666"])
46 
47  # Check result
48  self.assertFalse(any(result), "A valid commit has been detected as invalid.")
49 
50  def test_check_commit_with_invalid_author(self):
51  # Be verbose by default
52  common.g_trace = True
53 
54  # Apply the hook
56  ["ffffffff:anonymous@nowhere.com:fix(reactor): Prevent uncontrolled nuclear fusion. See #666"])
57 
58  # Check result
59  self.assertTrue(any(result), "An invalid commit has not been detected as invalid")
60 
61 
62 if __name__ == '__main__':
63  unittest.main()
def check_commit_messages(commit_messages)
Definition: check_commit.py:89