1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
# -*- coding: utf-8 -*-
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import pytest
import time
from azure.datalake.store.exceptions import DatalakeRESTException
from azure.datalake.store.lib import (DatalakeRESTInterface)
from tests import settings
from tests.testing import my_vcr
@pytest.fixture()
def token():
return settings.TOKEN_CREDEDENTIAL
@pytest.fixture()
def rest(token):
return DatalakeRESTInterface(settings.STORE_NAME, token)
def test_errors(token):
no_rest = DatalakeRESTInterface("none", token)
with pytest.raises(ValueError):
# no such op
no_rest.call('NONEXISTENT')
with pytest.raises(ValueError):
# too few parameters
no_rest.call("RENAME")
with pytest.raises(ValueError):
# too many parameters
no_rest.call('RENAME', many='', additional='', pars='')
with pytest.raises(DatalakeRESTException):
# no such store
no_rest.call('GETCONTENTSUMMARY')
@my_vcr.use_cassette
def test_response(rest):
out = rest.call('LISTSTATUS', '')
assert out
|