fixup! user: allow customization of User.get_full_name() through templates (#72945)
gitea-wip/hobo/pipeline/pr-main This commit looks good
Details
gitea-wip/hobo/pipeline/pr-main This commit looks good
Details
This commit is contained in:
parent
efd605875b
commit
299a1c236f
|
@ -1,11 +1,16 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
import hobo.test_utils
|
||||
|
||||
SETTINGS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
TESTS_DIR = os.path.join(os.path.dirname(SETTINGS_DIR), 'tests')
|
||||
sys.path.append(TESTS_DIR)
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
BROKER_URL = 'memory://'
|
||||
|
||||
INSTALLED_APPS += ('hobo.agent.common', 'hobo.user_name.apps.UserNameConfig')
|
||||
INSTALLED_APPS += ('hobo.agent.common', 'hobo.user_name.apps.UserNameConfig', 'user_name_test_app')
|
||||
|
||||
ALLOWED_HOSTS.append('localhost')
|
||||
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
import os
|
||||
|
||||
import pytest
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from hobo.agent.common.models import UserExtraAttributes
|
||||
|
||||
TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def user(db):
|
||||
|
@ -32,11 +28,9 @@ def test_user_cached_extra_attributes_missing_fallbacks_to_empty_dict(user):
|
|||
assert user.cached_extra_attributes == {}
|
||||
|
||||
|
||||
def test_user_get_full_name_from_template(user, settings):
|
||||
settings.TEMPLATES[0]['DIRS'] = [os.path.join(TESTS_DIR, 'templates')]
|
||||
def test_user_get_full_name_from_template(user):
|
||||
assert user.get_full_name_from_template() == 'Jane bar'
|
||||
|
||||
|
||||
def test_user_get_full_name(user, settings):
|
||||
settings.TEMPLATES[0]['DIRS'] = [os.path.join(TESTS_DIR, 'templates')]
|
||||
def test_user_get_full_name(user):
|
||||
assert user.get_full_name() == 'Jane bar'
|
||||
|
|
Loading…
Reference in New Issue