Exemplo n.º 1
0
def test_create_client_should_accept_email():
    user = factories.UserFactory()
    assert not amodels.Client.select().count()
    createclient(name='test client', user=user.email)
    assert amodels.Client.select().count() == 1
    client = amodels.Client.first()
    assert client.user == user
Exemplo n.º 2
0
def test_create_client_should_accept_email():
    user = factories.UserFactory()
    assert not amodels.Client.select().count()
    createclient(name='test client', user=user.email)
    assert amodels.Client.select().count() == 1
    client = amodels.Client.first()
    assert client.user == user
Exemplo n.º 3
0
def test_create_client_with_contributor_types(monkeypatch):
    monkeypatch.setattr('ban.commands.helpers.prompt',
                        lambda *x, **wk: 'ign laposte')
    user = factories.UserFactory()
    createclient(name='test client', user=user.username, scopes=['test'])
    client = amodels.Client.first()
    assert client.contributor_types == ['ign', 'laposte', 'viewer']
Exemplo n.º 4
0
def test_create_client_without_scopes(monkeypatch):
    monkeypatch.setattr('ban.commands.helpers.prompt', lambda *x, **wk: '')
    user = factories.UserFactory()
    createclient(name='test client',
                 user=user.username,
                 contributor_types=['develop'])
    client = amodels.Client.first()
    assert client.scopes == []
Exemplo n.º 5
0
def test_create_client_should_accept_email():
    user = factories.UserFactory()
    assert not amodels.Client.select().count()
    createclient(name='test client',
                 user=user.email,
                 scopes=['test'],
                 contributor_types=['develop'])
    assert amodels.Client.select().count() == 1
    client = amodels.Client.first()
    assert client.user == user
Exemplo n.º 6
0
def test_create_client_should_not_crash_on_non_existing_user(capsys):
    assert not amodels.Client.select().count()
    createclient(name='test client', user='******')
    assert not amodels.Client.select().count()
    out, err = capsys.readouterr()
    assert 'User not found' in out
Exemplo n.º 7
0
def test_create_client_should_not_crash_on_non_existing_user(capsys):
    assert not amodels.Client.select().count()
    createclient(name='test client', user='******')
    assert not amodels.Client.select().count()
    out, err = capsys.readouterr()
    assert 'User not found' in out