~homeworkprod/byceps

ref: 1181a35dd06d48c779208a6d2a4b3672dd38d812 byceps/tests/services/user/test_models_full_name.py -rw-r--r-- 670 bytes
1181a35d — Jochen Kupperschmidt Ported tests from nose2 to pytest 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""
:Copyright: 2006-2017 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""

import pytest

from testfixtures.user import create_user_with_detail


@pytest.mark.parametrize('first_names, last_name, expected', [
    (None,          None    , None                ),
    ('Giesbert Z.', None    , 'Giesbert Z.'       ),
    (None,          'Blümli', 'Blümli'            ),
    ('Giesbert Z.', 'Blümli', 'Giesbert Z. Blümli'),
])
def test_full_name(first_names, last_name, expected):
    user = create_user_with_detail(first_names=first_names,
                                   last_name=last_name)

    assert user.detail.full_name == expected