← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~pappacena/turnip:py3-v2-http-header into turnip:master

 

Thiago F. Pappacena has proposed merging ~pappacena/turnip:py3-v2-http-header into turnip:master.

Commit message:
Fixing some v2 protocol py3 test compatibilities

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~pappacena/turnip/+git/turnip/+merge/391074
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~pappacena/turnip:py3-v2-http-header into turnip:master.
diff --git a/turnip/pack/tests/test_helpers.py b/turnip/pack/tests/test_helpers.py
index d32f588..ff484e8 100644
--- a/turnip/pack/tests/test_helpers.py
+++ b/turnip/pack/tests/test_helpers.py
@@ -323,7 +323,8 @@ class TestCapabilityAdvertisement(TestCase):
         subprocess.call(['git', 'init', root])
 
         git_version = subprocess.check_output(['git', '--version'])
-        git_version_num = six.ensure_binary(git_version.split(' ')[-1].strip())
+        git_version_num = six.ensure_binary(
+            git_version.split(b' ')[-1].strip())
         git_agent = encode_packet(b"agent=git/%s\n" % git_version_num)
 
         proc = subprocess.Popen(
@@ -332,8 +333,8 @@ class TestCapabilityAdvertisement(TestCase):
         git_advertised_capabilities, _ = proc.communicate()
 
         turnip_capabilities = get_capabilities_advertisement(version=b'2')
-        turnip_agent = encode_packet(
-            b"agent=git/2.25.1@turnip/%s\n" % version_info["revision_id"])
+        version = six.ensure_binary(version_info["revision_id"])
+        turnip_agent = encode_packet(b"agent=git/2.25.1@turnip/%s\n" % version)
 
         self.assertEqual(
             turnip_capabilities,
diff --git a/turnip/pack/tests/test_http.py b/turnip/pack/tests/test_http.py
index fff38a4..3122ae6 100644
--- a/turnip/pack/tests/test_http.py
+++ b/turnip/pack/tests/test_http.py
@@ -9,6 +9,7 @@ from __future__ import (
 
 from io import BytesIO
 
+import six
 from testtools import TestCase
 from testtools.deferredruntest import AsynchronousDeferredRunTest
 from twisted.internet import (
@@ -200,13 +201,13 @@ class TestSmartHTTPRefsResource(ErrorTestMixin, TestCase):
             b'And I am raw, since we got a good packet to start with.')
         self.assertEqual(200, self.request.responseCode)
         self.assertEqual(self.root.client_factory.params, {
-            'version': '2',
-            'turnip-advertise-refs': 'yes',
-            'turnip-can-authenticate': 'yes',
-            'turnip-request-id': mock.ANY,
-            'turnip-stateless-rpc': 'yes'})
+            b'version': b'2',
+            b'turnip-advertise-refs': b'yes',
+            b'turnip-can-authenticate': b'yes',
+            b'turnip-request-id': mock.ANY,
+            b'turnip-stateless-rpc': b'yes'})
 
-        ver = version_info["revision_id"]
+        ver = six.ensure_binary(version_info["revision_id"])
         capabilities = (
             encode_packet(b'version 2\n') +
             encode_packet(b'agent=git/2.25.1@turnip/%s\n' % ver) +
@@ -217,9 +218,9 @@ class TestSmartHTTPRefsResource(ErrorTestMixin, TestCase):
             )
         self.assertEqual(
             capabilities +
-            '001e# service=git-upload-pack\n'
-            '0000001bI am git protocol data.'
-            'And I am raw, since we got a good packet to start with.',
+            b'001e# service=git-upload-pack\n'
+            b'0000001bI am git protocol data.'
+            b'And I am raw, since we got a good packet to start with.',
             self.request.value)