Skip to content
Snippets Groups Projects
Commit 1b6e6634 authored by Jeremy Bowman's avatar Jeremy Bowman Committed by Feanil Patel
Browse files

Fix edxnotes stub tests BOM-633

parent 835a84f3
No related branches found
No related tags found
No related merge requests found
...@@ -121,7 +121,7 @@ class StubEdxNotesServiceHandler(StubHttpRequestHandler): ...@@ -121,7 +121,7 @@ class StubEdxNotesServiceHandler(StubHttpRequestHandler):
} }
if status_code < 400 and content: if status_code < 400 and content:
headers["Content-Type"] = "application/json" headers["Content-Type"] = "application/json"
content = json.dumps(content) content = json.dumps(content).encode('utf-8')
else: else:
headers["Content-Type"] = "text/html" headers["Content-Type"] = "text/html"
...@@ -131,7 +131,7 @@ class StubEdxNotesServiceHandler(StubHttpRequestHandler): ...@@ -131,7 +131,7 @@ class StubEdxNotesServiceHandler(StubHttpRequestHandler):
""" """
Create a note, assign id, annotator_schema_version, created and updated dates. Create a note, assign id, annotator_schema_version, created and updated dates.
""" """
note = json.loads(self.request_content) note = json.loads(self.request_content.decode('utf-8'))
note.update({ note.update({
"id": uuid4().hex, "id": uuid4().hex,
"annotator_schema_version": "v1.0", "annotator_schema_version": "v1.0",
...@@ -146,7 +146,7 @@ class StubEdxNotesServiceHandler(StubHttpRequestHandler): ...@@ -146,7 +146,7 @@ class StubEdxNotesServiceHandler(StubHttpRequestHandler):
The same as self._create, but it works a list of notes. The same as self._create, but it works a list of notes.
""" """
try: try:
notes = json.loads(self.request_content) notes = json.loads(self.request_content.decode('utf-8'))
except ValueError: except ValueError:
self.respond(400, "Bad Request") self.respond(400, "Bad Request")
return return
...@@ -181,7 +181,7 @@ class StubEdxNotesServiceHandler(StubHttpRequestHandler): ...@@ -181,7 +181,7 @@ class StubEdxNotesServiceHandler(StubHttpRequestHandler):
""" """
Update the note by note id. Update the note by note id.
""" """
note = self.server.update_note(note_id, json.loads(self.request_content)) note = self.server.update_note(note_id, json.loads(self.request_content.decode('utf-8')))
if note: if note:
self.respond(content=note) self.respond(content=note)
else: else:
......
...@@ -92,7 +92,7 @@ class StubHttpRequestHandler(BaseHTTPRequestHandler, object): ...@@ -92,7 +92,7 @@ class StubHttpRequestHandler(BaseHTTPRequestHandler, object):
Retrieve the content of the request. Retrieve the content of the request.
""" """
try: try:
length = int(self.headers.getheader('content-length')) length = int(self.headers.get('content-length'))
except (TypeError, ValueError): except (TypeError, ValueError):
return "" return ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment