Ejemplo n.º 1
0
def test_login():
    data = {
        'isValid': True,
        'messages': [],
        'user': {
            'User': '******',
            'FullName': 'Swarm User',
            'Email': '*****@*****.**',
            'Type': 'standard',
            'Password': '******',
            'isAdmin': False,
            'isSuper': False
        }
    }

    responses.add(
        responses.POST,
        re.compile(r'.*/api/v\d+/login'),
        json=data
    )

    client = SwarmClient('http://server/api/v9', 'login', 'password')

    response = client.login()
    assert 'user' in response
Ejemplo n.º 2
0
def test_login_saml():
    data = {
        'isValid': 'true',
        'url': '<url to redirect to>'
    }

    responses.add(
        responses.POST,
        re.compile(r'.*/api/v\d+/login/saml'),
        json=data
    )

    client = SwarmClient('http://server/api/v9', 'login', 'password')

    response = client.login(saml=True)
    assert 'isValid' in response