[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/master] Fix moat test



commit c08de396a039f559adc60a7b2a1c81aa8da0bfa0
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sat Jan 18 16:29:21 2020 -0800

    Fix moat test
    
    Trivial byte hiccup...
    
      Traceback (most recent call last):
        File "/home/atagar/Desktop/tor/bridgedb/bridgedb/test/test_distributors_moat_server.py", line 183, in test_formatDataForResponse_no_data
          rendered = self.resource.formatDataForResponse(None, request)
        File "/home/atagar/Desktop/tor/bridgedb/bridgedb/distributors/moat/server.py", line 182, in formatDataForResponse
          request.responseHeaders.addRawHeader(b"Server", b"moat/%s" % MOAT_API_VERSION)
      builtins.TypeError: %b requires bytes, or an object that implements __bytes__, not 'str'
    
    Test results changed as follows...
    
      before: FAILED (skips=114, failures=16, errors=76, successes=778)
      after:  FAILED (skips=114, failures=21, errors=57, successes=792)
---
 bridgedb/distributors/moat/server.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bridgedb/distributors/moat/server.py b/bridgedb/distributors/moat/server.py
index 7391325..c2f59c1 100644
--- a/bridgedb/distributors/moat/server.py
+++ b/bridgedb/distributors/moat/server.py
@@ -179,7 +179,7 @@ class JsonAPIResource(resource.Resource):
         :returns: The encoded data.
         """
         request.responseHeaders.addRawHeader(b"Content-Type", b"application/vnd.api+json")
-        request.responseHeaders.addRawHeader(b"Server", b"moat/%s" % MOAT_API_VERSION)
+        request.responseHeaders.addRawHeader(b"Server", b"moat/%s" % MOAT_API_VERSION.encode('utf-8'))
 
         if data:
             rendered = json.dumps(data)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits