Ejemplo n.º 1
0
def test_set_date_of_birth_invalid_type(app):
    user = User('*****@*****.**', 'blah')

    with pytest.raises(TypeError) as e:
        user.date_of_birth = '19.2.2018'

    assert str(e.value) == 'Date of birth must be date.'
Ejemplo n.º 2
0
def test_unset_date_of_birth(app):
    user = User('*****@*****.**', 'blah', date_of_birth=datetime.date(1996, 2, 20))

    assert user.date_of_birth is not None

    user.date_of_birth = None

    assert user.date_of_birth is None
Ejemplo n.º 3
0
def test_set_date_of_birth(app):
    user = User('*****@*****.**', 'blah')

    assert user.date_of_birth is None

    user.date_of_birth = datetime.date(1996, 2, 20)

    assert user.date_of_birth == datetime.date(1996, 2, 20)