Fix Unicode/bytes handling for Basic Auth in Py3

Also add tests for Basic Auth handling.