Example #1
0
def test_user_initials():
    # initials should be first char of firstname followed by first char of last name
    user1 = User(username='******', firstname='firstname_mock', lastname='lastname_mock')
    user2 = User(username='******', firstname='firstname_mock', lastname='l')
    user3 = User(username='******', firstname='f', lastname='lastname_mock')
    user4 = User(username='******', firstname='f', lastname='l')
    assert user1.initials == 'fl'
    assert user2.initials == 'fl'
    assert user3.initials == 'fl'
    assert user4.initials == 'fl'

    # initials should be first two chars of username
    user5 = User(username='******')
    user6 = User(username='******', firstname='f')
    user7 = User(username='******', lastname='l')
    assert user5.initials == 'us'
    assert user6.initials == 'us'
    assert user7.initials == 'us'

    # initials should be first two chars of firstname or lastname
    user8 = User(username='******', firstname='firstname_mock')
    user9 = User(username='******', lastname='lastname_mock')
    assert user8.initials == 'fi'
    assert user9.initials == 'la'

    user1.__repr__()
Example #2
0
def test_user_initials():
    # initials should be first char of firstname followed by first char of last name
    user1 = User(username="******",
                 firstname="firstname_mock",
                 lastname="lastname_mock")
    user2 = User(username="******",
                 firstname="firstname_mock",
                 lastname="l")
    user3 = User(username="******",
                 firstname="f",
                 lastname="lastname_mock")
    user4 = User(username="******", firstname="f", lastname="l")
    assert user1.initials == "fl"
    assert user2.initials == "fl"
    assert user3.initials == "fl"
    assert user4.initials == "fl"

    # initials should be first two chars of username
    user5 = User(username="******")
    user6 = User(username="******", firstname="f")
    user7 = User(username="******", lastname="l")
    assert user5.initials == "us"
    assert user6.initials == "us"
    assert user7.initials == "us"

    # initials should be first two chars of firstname or lastname
    user8 = User(username="******", firstname="firstname_mock")
    user9 = User(username="******", lastname="lastname_mock")
    assert user8.initials == "fi"
    assert user9.initials == "la"

    user1.__repr__()
Example #3
0
def test_user_fullname():
    user1 = User(username='******', firstname='firstname_mock', lastname='lastname_mock')
    user2 = User(username='******', firstname='firstname_mock')
    user3 = User(username='******', lastname='lastname_mock')
    user4 = User(username='******')
    assert user1.fullname == 'firstname_mock lastname_mock'
    assert user2.fullname == 'firstname_mock'
    assert user3.fullname == 'lastname_mock'
    assert user4.fullname == 'username_mock'

    user1.__repr__()
Example #4
0
def test_user_fullname():
    user1 = User(username="******",
                 firstname="firstname_mock",
                 lastname="lastname_mock")
    user2 = User(username="******", firstname="firstname_mock")
    user3 = User(username="******", lastname="lastname_mock")
    user4 = User(username="******")
    assert user1.fullname == "firstname_mock lastname_mock"
    assert user2.fullname == "firstname_mock"
    assert user3.fullname == "lastname_mock"
    assert user4.fullname == "username_mock"

    user1.__repr__()
def test_string_representation_of_user():
    user = User('hehe')
    user.__repr__()