예제 #1
0
def test_introduce_username():
    """user gets introduced by username."""
    user = User()
    # 'User not saved should be represented by \'None\'')
    assert str(user) == 'None'
    user.id = 1
    # if id is set, user should be presented with it
    assert str(user) == '1'

    user.email = text_type('*****@*****.**')
    user.username = text_type('testowy')
    # To string should return username
    assert str(user) == 'testowy'
    # User should be represented by "<User (\'1\')>"
    assert user.__repr__() == "<User ('1')>"
예제 #2
0
def test_introduce_username():
    """User gets introduced by username."""
    user = User()
    # 'User not saved should be represented by \'None\'')
    assert str(user) == "None"
    user.id = 1
    # if id is set, user should be presented with it
    assert str(user) == "1"

    user.email = "*****@*****.**"
    user.username = "******"
    # To string should return username
    assert str(user) == "testowy"
    # User should be represented by "<User (\'1\')>"
    assert user.__repr__() == "<User ('1')>"