kriti21

Untitled

May 2nd, 2018
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.98 KB | None | 0 0
  1.     def test_revert_commit(self):
  2.         self.git_commit('Test commit')
  3.         self.git_commit('Revert "Test commit"\n\n'
  4.                         'This reverts commit <sha>\n')
  5.  
  6.         self.assertEqual(self.run_uut(),
  7.                          ['Revert commit does not have a reason.'])
  8.         self.assert_no_msgs()
  9.  
  10.         self.assertEqual(self.run_uut(allow_revert_commits=True),
  11.                          [])
  12.         self.assert_no_msgs()
  13.  
  14.         self.git_commit('Test commit')
  15.         self.git_commit('Revert "New Test commit"\n\n'
  16.                         'This reverts commit <sha>\n\n'
  17.                         'Reason for the revert commit is explained here.\n')
  18.  
  19.         self.assertEqual(self.run_uut(),
  20.                          ['Shortlog of revert commit does not match the original commit.'])
  21.         self.assert_no_msgs()        
  22.  
  23.         self.git_commit('Test commit')
  24.         self.git_commit('Revert "Test commit"\n\n'
  25.                         'This reverts commit <sha1>\n\n'
  26.                         'This revert commit has wrong commit hash.\n')
  27.  
  28.         self.assertEqual(self.run_uut(),
  29.                          ['Invalid revert commit.'])
  30.         self.assert_no_msgs()
  31.  
  32.         self.git_commit('Test commit')
  33.         self.git_commit('Revert "Test commit"\n\n'
  34.                         'This reverts commit <sha>\n\n'
  35.                         'Reason for the revert commit is explained here'
  36.                         'This reason is too long'
  37.                         'Reason for the revert commit must not exceed 50 characters\n')
  38.  
  39.         self.assertEqual(self.run_uut(),
  40.                          ['Reason of revert is too long.'])
  41.         self.assert_no_msgs()
  42.  
  43.         self.git_commit('Test commit')
  44.         self.git_commit('Revert "Test commit"\n\n'
  45.                         'This reverts commit <sha>\n\n'
  46.                         'Reason for the revert commit is explained here.\n')
  47.  
  48.         self.assertEqual(self.run_uut(), [])
  49.         self.assert_no_msgs()
Add Comment
Please, Sign In to add comment