mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 11:00:03 -03:30
Fix broken tests after removing session authentication.
This commit is contained in:
parent
a25a162229
commit
e2e8a7e346
@ -130,6 +130,7 @@ class ApiV1ConfigView(APIView):
|
||||
|
||||
class AuthTokenView(APIView):
|
||||
|
||||
authentication_classes = []
|
||||
permission_classes = (AllowAny,)
|
||||
serializer_class = AuthTokenSerializer
|
||||
model = AuthToken
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
# All Rights Reserved.
|
||||
|
||||
# Python
|
||||
import base64
|
||||
import contextlib
|
||||
import datetime
|
||||
import json
|
||||
@ -175,7 +176,11 @@ class BaseTestMixin(object):
|
||||
auth = auth or self._current_auth
|
||||
if auth:
|
||||
if isinstance(auth, (list, tuple)):
|
||||
client.login(username=auth[0], password=auth[1])
|
||||
#client.login(username=auth[0], password=auth[1])
|
||||
basic_auth = base64.b64encode('%s:%s' % (auth[0], auth[1]))
|
||||
basic_auth = basic_auth.decode('ascii')
|
||||
client_kwargs['HTTP_AUTHORIZATION'] = 'Basic %s' % basic_auth
|
||||
client = Client(**client_kwargs)
|
||||
elif isinstance(auth, basestring):
|
||||
client_kwargs['HTTP_AUTHORIZATION'] = 'Token %s' % auth
|
||||
client = Client(**client_kwargs)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user