Skip to content

Commit 3ee1a83

Browse files
committed
python3 compat fixes
1 parent 6c525a6 commit 3ee1a83

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

st2auth_keystone_backend/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from keystone import KeystoneAuthenticationBackend
16+
from .keystone import KeystoneAuthenticationBackend
1717

1818
__all__ = [
1919
'KeystoneAuthenticationBackend'

st2auth_keystone_backend/keystone.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515

1616
import logging
17-
import httplib
17+
import http.client
1818

1919
import requests
2020

@@ -65,7 +65,7 @@ def authenticate(self, username, password):
6565
LOG.debug('Authentication for user "{}" failed: {}'.format(username, str(e)))
6666
return False
6767

68-
if login.status_code in [httplib.OK, httplib.CREATED]:
68+
if login.status_code in [http.client.OK, http.client.CREATED]:
6969
LOG.debug('Authentication for user "{}" successful'.format(username))
7070
return True
7171
else:

tests/unit/test_keystone_backend.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515

1616
import sys
17-
import httplib
17+
import http.client
1818

1919
import unittest
2020
import mock
@@ -26,9 +26,9 @@
2626
class KeystoneAuthenticationBackendTestCase(unittest.TestCase):
2727
def _mock_keystone(self, *args, **kwargs):
2828
return_codes = {
29-
'goodv2': httplib.OK,
30-
'goodv3': httplib.CREATED,
31-
'bad': httplib.UNAUTHORIZED
29+
'goodv2': http.client.OK,
30+
'goodv3': http.client.CREATED,
31+
'bad': http.client.UNAUTHORIZED
3232
}
3333
json = kwargs.get('json')
3434
res = Response()

0 commit comments

Comments
 (0)