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

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

@ -546,9 +546,6 @@ SWAGGER_SETTINGS = {"enabled_methods": ['get', ]}
HAWK_CREDENTIALS_LOOKUP = 'treeherder.webapp.api.auth.hawk_lookup' 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 # Configuration for elasticsearch backend
ELASTIC_SEARCH = { ELASTIC_SEARCH = {
"url": env.str('ELASTICSEARCH_URL', default=""), "url": env.str('ELASTICSEARCH_URL', default=""),