Bug 1284853 - Skip creating a user in the client_credentials fixture

Since Hawk credentials can now be created without an owner, there's no
need for this fixture to create a user to be associated with the test
Hawk credentials, since none of the tests using the `client_credentials`
fixture actually use the created user.

The `transactional_db` fixture is now required since it's no longer
inherited from the `test_user` fixture.

Also switch back to `.create()` rather than `.get_or_create()` now that
bug 1133273 is fixed.
This commit is contained in:
Ed Morley 2016-07-06 15:26:58 +01:00
Родитель 1ede6b0a33
Коммит ea5194f486
2 изменённых файлов: 4 добавлений и 10 удалений

Просмотреть файл

@ -467,15 +467,12 @@ def test_sheriff(request, transactional_db):
@pytest.fixture
def client_credentials(request, test_user):
from django.conf import settings
def client_credentials(request, transactional_db):
from treeherder.credentials.models import Credentials
# We need to get_or_create here because of bug 1133273.
# It can be a straight create once that bug is solved.
client_credentials, _ = Credentials.objects.get_or_create(
client_id=settings.ETL_CLIENT_ID,
defaults={'owner': test_user, 'authorized': True}
client_credentials = Credentials.objects.create(
client_id='test_client',
authorized=True
)
def fin():

Просмотреть файл

@ -546,9 +546,6 @@ SWAGGER_SETTINGS = {"enabled_methods": ['get', ]}
HAWK_CREDENTIALS_LOOKUP = 'treeherder.webapp.api.auth.hawk_lookup'
# This is the client ID used by the internal data ingestion service.
ETL_CLIENT_ID = 'treeherder-etl'
# Configuration for elasticsearch backend
ELASTIC_SEARCH = {
"url": env.str('ELASTICSEARCH_URL', default=""),