import pytest

import konviva


def test_create_user_email_exists():
    with pytest.raises(konviva.KonvivaError):
        konviva.create_user(
            id='',
            name='Sérgio R Siquira',
            email='sergio@somosbeta.com.br',
            cpf='0879819908',
        )


def test_get_users_by_email():
    r = konviva.get_users_by_email('sergio@somosbeta.com.br')
    assert len(r) >= 1


def test_get_users_by_email_notfound():
    r = konviva.get_users_by_email('fake@fake.com')
    assert r == []
