Skip to content

Commit a461e80

Browse files
author
Andrew Bettke
committed
Correctly encode / decode for python3+.
1 parent 83a2ad3 commit a461e80

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

graphene_django/tests/test_query.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -947,16 +947,19 @@ class Query(graphene.ObjectType):
947947
}
948948
"""
949949

950+
def str_to_node_id(val):
951+
return base64.b64encode(val.encode()).decode()
952+
950953
expected = {
951954
"allReporters": {
952955
"edges": [
953-
{"node": {"id": base64.b64encode("ReporterType:{}".format(reporter.id).encode())}},
954-
{"node": {"id": base64.b64encode("ReporterType:{}".format(cnn_reporter.id).encode())}},
956+
{"node": {"id": str_to_node_id("ReporterType:{}".format(reporter.id))}},
957+
{"node": {"id": str_to_node_id("ReporterType:{}".format(cnn_reporter.id))}},
955958
]
956959
},
957960
"cnnReporters": {
958961
"edges": [
959-
{"node": {"id": base64.b64encode("CNNReporterType:{}".format(cnn_reporter.id).encode())}}
962+
{"node": {"id": str_to_node_id("CNNReporterType:{}".format(cnn_reporter.id))}}
960963
]
961964
}
962965
}

0 commit comments

Comments
 (0)