Exemplo n.º 1
0
def test_password_hashing():
    '''We are not storing passwords as plaintext, hooray
    '''
    a = PersonFactory(password='******')
    assert a.check_password('python')
    assert a.password != 'python'
    assert a.password_hash != 'python'
Exemplo n.º 2
0
def user_api_client():
    person = PersonFactory()
    user = UserFactory(
        is_staff=False,
        person=person,
    )
    client = APIClient()
    client.force_authenticate(user=user)
    return client
Exemplo n.º 3
0
def test_default_roles():
    a = PersonFactory()
    assert a.roles == []
    assert not a.is_speaker()
    assert not a.is_miniconf_org()
    assert not a.is_professional()
    assert not a.is_volunteer()
Exemplo n.º 4
0
def test_factory_basics():
    '''Testing the defaults that we set with factory_boy
    '''
    a = PersonFactory()
    assert a.firstname == "User 1"
    assert a.lastname == "Doe"
    assert a.fullname == "User 1 Doe"
    assert a.email_address == "*****@*****.**"
    assert repr(a) == '<Person id="1" email="*****@*****.**">'
    assert a.address1 == '1 Main Street'
    assert a.address2 == None
    assert a.city == 'Suburb 1'
    assert a.state == 'VIC'
    assert a.postcode == '3000'
    assert a.country == 'Australia'
    assert a.mobile == '0400000001'
    assert a.url == 'http://www.User1Doe.com'
Exemplo n.º 5
0
def person():
    return PersonFactory()
Exemplo n.º 6
0
def test_is_from_common_country():
    a = PersonFactory(country='Australia')
    assert a.is_from_common_country()
    b = PersonFactory(country='Venezuela')
    assert not b.is_from_common_country()