Ejemplo n.º 1
0
def test_parse_user_by_email():
    user = get_user(make_connection_parser().parse_args(
        ['-u', '*****@*****.**']))
    expected = User('*****@*****.**',
                    alias='*****@*****.**',
                    host='platform.genestack.org')
    assert user == expected
Ejemplo n.º 2
0
def test_token_without_username():
    parser = make_connection_parser()
    some_token = 'some_token'
    args = parser.parse_args(['--token', some_token])
    user = get_user(args)
    assert user.token == some_token
    assert user.host == DEFAULT_HOST
Ejemplo n.º 3
0
def test_token_without_username():
    parser = make_connection_parser()
    some_token = 'some_token'
    args = parser.parse_args(['--token', some_token])
    user = get_user(args)
    assert user.token == some_token
    assert user.host == DEFAULT_HOST
Ejemplo n.º 4
0
def test_parse_default_user():
    user = get_user(make_connection_parser().parse_args())
    expected = User('*****@*****.**',
                    alias='tester',
                    host='localhost:8080',
                    password='******',
                    token=None)
    assert user == expected
Ejemplo n.º 5
0
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
import os
import sys

import pytest

sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from genestack_client import (Connection, GenestackAuthenticationException,
                              GenestackConnectionFailure, GenestackResponseError, get_user,
                              GenestackException)
from genestack_client.settings.genestack_user import _get_server_url

wrong_url = 'http://localhost:9999/aaaaz'

user = get_user()

server_url = _get_server_url(user.host)
user_login = user.email
user_pwd = user.password


def test_connection_to_wrong_url():
    with pytest.raises(GenestackConnectionFailure, match='<connection failed '):
        connection = Connection(wrong_url)
        connection.login(user_login, user_pwd)


def test_connection_404():
    with pytest.raises(GenestackResponseError,
                       match='<urlopen error 404 Client Error: Not Found for url:'):
Ejemplo n.º 6
0
# actual or intended publication of such source code.
#

import os
import sys
from urllib2 import URLError
import pytest

sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
from genestack_client import Connection, GenestackException
from genestack_client import get_user
from genestack_client.settings.genestack_user import _get_server_url

wrong_url = 'http://localhost:9999/aaaaz'

user = get_user()

server_url = _get_server_url(user.host)
user_login = user.email
user_pwd = user.password


def test_connection_to_wrong_url():
    with pytest.raises(URLError):
        connection = Connection(wrong_url)
        connection.login(user_login, user_pwd)


def test_login_positive():
    connection = Connection(server_url)
    connection.login(user_login, user_pwd)
Ejemplo n.º 7
0
def conn(args):
    if get_user(args).host != "internal-dev.genestack.com":
        sys.stderr.write("Tests must be run on internal-dev")
        sys.exit(1)
    connection = get_connection(args)
    return connection
def conn(args):
    if get_user(args).host != "internal-dev.genestack.com":
        sys.stderr.write("Tests must be run on internal-dev")
        sys.exit(1)
    connection = get_connection(args)
    return connection
Ejemplo n.º 9
0
def test_parse_user_by_email():
    user = get_user(make_connection_parser().parse_args(['-u', '*****@*****.**']))
    expected = User('*****@*****.**', alias='*****@*****.**',
                    host='platform.genestack.org')
    assert user == expected
Ejemplo n.º 10
0
def test_parse_default_user():
    user = get_user(make_connection_parser().parse_args())
    expected = User('*****@*****.**', alias='tester',
                    host='localhost:8080', password='******', token=None)
    assert user == expected