diff options
| author | Cory Johns <johnsca@gmail.com> | 2014-03-03 23:09:39 +0000 | 
|---|---|---|
| committer | Cory Johns <johnsca@gmail.com> | 2014-03-03 23:09:44 +0000 | 
| commit | 8005591231c8ae329f0ff320385b190d2ea81df0 (patch) | |
| tree | 617e7d72a7559ad02bab0495a6d0035b0e44c9c9 /git/test | |
| parent | 56d7a9b64b6d768dd118a02c1ed2afb38265c8b9 (diff) | |
| download | gitpython-8005591231c8ae329f0ff320385b190d2ea81df0.tar.gz | |
[#7021] Added serialization and test from upstream and fixed test issues
Diffstat (limited to 'git/test')
| -rw-r--r-- | git/test/fixtures/commit_with_gpgsig | 30 | ||||
| -rw-r--r-- | git/test/lib/helper.py | 2 | ||||
| -rw-r--r-- | git/test/test_commit.py | 42 | 
3 files changed, 73 insertions, 1 deletions
diff --git a/git/test/fixtures/commit_with_gpgsig b/git/test/fixtures/commit_with_gpgsig new file mode 100644 index 00000000..f38cdabd --- /dev/null +++ b/git/test/fixtures/commit_with_gpgsig @@ -0,0 +1,30 @@ +tree cefbccb4843d821183ae195e70a17c9938318945 +parent 904435cf76a9bdd5eb41b1c4e049d5a64f3a8400 +author Jon Mason <jon.mason@intel.com> 1367013117 -0700 +committer Jon Mason <jon.mason@intel.com> 1368640702 -0700 +gpgsig -----BEGIN PGP SIGNATURE----- + Version: GnuPG v1.4.11 (GNU/Linux) +  + iQIcBAABAgAGBQJRk8zMAAoJEG5mS6x6i9IjsTEP/0v2Wx/i7dqyKban6XMIhVdj + uI0DycfXqnCCZmejidzeao+P+cuK/ZAA/b9fU4MtwkDm2USvnIOrB00W0isxsrED + sdv6uJNa2ybGjxBolLrfQcWutxGXLZ1FGRhEvkPTLMHHvVriKoNFXcS7ewxP9MBf + NH97K2wauqA+J4BDLDHQJgADCOmLrGTAU+G1eAXHIschDqa6PZMH5nInetYZONDh + 3SkOOv8VKFIF7gu8X7HC+7+Y8k8U0TW0cjlQ2icinwCc+KFoG6GwXS7u/VqIo1Yp + Tack6sxIdK7NXJhV5gAeAOMJBGhO0fHl8UUr96vGEKwtxyZhWf8cuIPOWLk06jA0 + g9DpLqmy/pvyRfiPci+24YdYRBua/vta+yo/Lp85N7Hu/cpIh+q5WSLvUlv09Dmo + TTTG8Hf6s3lEej7W8z2xcNZoB6GwXd8buSDU8cu0I6mEO9sNtAuUOHp2dBvTA6cX + PuQW8jg3zofnx7CyNcd3KF3nh2z8mBcDLgh0Q84srZJCPRuxRcp9ylggvAG7iaNd + XMNvSK8IZtWLkx7k3A3QYt1cN4y1zdSHLR2S+BVCEJea1mvUE+jK5wiB9S4XNtKm + BX/otlTa8pNE3fWYBxURvfHnMY4i3HQT7Bc1QjImAhMnyo2vJk4ORBJIZ1FTNIhJ + JzJMZDRLQLFvnzqZuCjE + =przd + -----END PGP SIGNATURE----- + +NTB: Multiple NTB client fix + +Fix issue with adding multiple ntb client devices to the ntb virtual +bus.  Previously, multiple devices would be added with the same name, +resulting in crashes.  To get around this issue, add a unique number to +the device when it is added. + +Signed-off-by: Jon Mason <jon.mason@intel.com> diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py index 3a60d116..5790a858 100644 --- a/git/test/lib/helper.py +++ b/git/test/lib/helper.py @@ -227,7 +227,7 @@ class TestBase(TestCase):  	"""  	@classmethod -	def setUpAll(cls): +	def setUpClass(cls):  		"""  		Dynamically add a read-only repository to our actual type. This way   		each test type has its own repository diff --git a/git/test/test_commit.py b/git/test/test_commit.py index 4a8d8b87..0b7ed9ff 100644 --- a/git/test/test_commit.py +++ b/git/test/test_commit.py @@ -13,6 +13,7 @@ from gitdb.util import hex_to_bin  from cStringIO import StringIO  import time  import sys +import re  def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False): @@ -273,3 +274,44 @@ class TestCommit(TestBase):  		# it appears  		cmt.author.__repr__() +	def test_gpgsig(self): +		cmt = self.rorepo.commit() +		cmt._deserialize(open(fixture_path('commit_with_gpgsig'))) + +		fixture_sig = """-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.11 (GNU/Linux) + +iQIcBAABAgAGBQJRk8zMAAoJEG5mS6x6i9IjsTEP/0v2Wx/i7dqyKban6XMIhVdj +uI0DycfXqnCCZmejidzeao+P+cuK/ZAA/b9fU4MtwkDm2USvnIOrB00W0isxsrED +sdv6uJNa2ybGjxBolLrfQcWutxGXLZ1FGRhEvkPTLMHHvVriKoNFXcS7ewxP9MBf +NH97K2wauqA+J4BDLDHQJgADCOmLrGTAU+G1eAXHIschDqa6PZMH5nInetYZONDh +3SkOOv8VKFIF7gu8X7HC+7+Y8k8U0TW0cjlQ2icinwCc+KFoG6GwXS7u/VqIo1Yp +Tack6sxIdK7NXJhV5gAeAOMJBGhO0fHl8UUr96vGEKwtxyZhWf8cuIPOWLk06jA0 +g9DpLqmy/pvyRfiPci+24YdYRBua/vta+yo/Lp85N7Hu/cpIh+q5WSLvUlv09Dmo +TTTG8Hf6s3lEej7W8z2xcNZoB6GwXd8buSDU8cu0I6mEO9sNtAuUOHp2dBvTA6cX +PuQW8jg3zofnx7CyNcd3KF3nh2z8mBcDLgh0Q84srZJCPRuxRcp9ylggvAG7iaNd +XMNvSK8IZtWLkx7k3A3QYt1cN4y1zdSHLR2S+BVCEJea1mvUE+jK5wiB9S4XNtKm +BX/otlTa8pNE3fWYBxURvfHnMY4i3HQT7Bc1QjImAhMnyo2vJk4ORBJIZ1FTNIhJ +JzJMZDRLQLFvnzqZuCjE +=przd +-----END PGP SIGNATURE-----""" +		self.assertEqual(cmt.gpgsig, fixture_sig) +		self.assertIn('NTB: Multiple NTB client fix', cmt.message) +		cmt.gpgsig = "<test\ndummy\nsig>" +		self.assertNotEqual(cmt.gpgsig, fixture_sig) + +		cstream = StringIO() +		cmt._serialize(cstream) +		value = cstream.getvalue() +		self.assertRegexpMatches(value, re.compile(r"^gpgsig <test\n dummy\n sig>$", re.MULTILINE)) + +		cstream.seek(0) +		cmt.gpgsig = None +		cmt._deserialize(cstream) +		self.assertEqual(cmt.gpgsig, "<test\ndummy\nsig>") + +		cmt.gpgsig = None +		cstream = StringIO() +		cmt._serialize(cstream) +		value = cstream.getvalue() +		self.assertNotRegexpMatches(value, re.compile(r"^gpgsig ", re.MULTILINE))  | 
