Exemple #1
0
def test_exception_auth_error(port):
    """
    AuthError exception raising text.
    Wrong user or password.
    """
    array = hpestorapi.StoreServ('127.0.0.1',
                                 'user',
                                 'wrong-password',
                                 ssl=False,
                                 port=port)
    with pytest.raises(hpestorapi.storeserv.AuthError):
        array.open()
Exemple #2
0
def test_get(port):
    """
    GET request
    """
    with hpestorapi.StoreServ('127.0.0.1',
                              '3paradm',
                              '3pardata',
                              ssl=False,
                              port=port) as array:
        array.open()
        status, _ = array.get('system')
        assert status == 200
Exemple #3
0
def test_exception_connection_error(port):
    """
    ConnectionError exception raising test.
    Wrong network address, firewall or rest api connection limit ...
    """
    array = hpestorapi.StoreServ('wrong-address',
                                 'user',
                                 'password',
                                 ssl=False,
                                 port=port)
    with pytest.raises(requests.exceptions.ConnectionError):
        array.open()
Exemple #4
0
def test_post(port):
    """
    POST request
    """
    with hpestorapi.StoreServ('127.0.0.1',
                              '3paradm',
                              '3pardata',
                              ssl=False,
                              port=port) as array:
        array.open()
        status, _ = array.post('hosts', {
            'name': 'RestApiTestHost',
            'persona': 5
        })
        assert status == 201