Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_non_default_wait_on_rate_limit(self):
connection_object = dnacentersdk.DNACenterAPI(username=DNA_CENTER_USERNAME,
password=DNA_CENTER_PASSWORD,
encoded_auth=DNA_CENTER_ENCODED_AUTH,
base_url=DEFAULT_BASE_URL,
wait_on_rate_limit=not DEFAULT_WAIT_ON_RATE_LIMIT,
verify=DEFAULT_VERIFY,
version=DNA_CENTER_VERSION)
assert connection_object.wait_on_rate_limit != \
DEFAULT_WAIT_ON_RATE_LIMIT
def validate(self, request):
try:
self._validator(request)
except fastjsonschema.exceptions.JsonSchemaException as e:
raise MalformedRequest(
'{} is invalid. Reason: {}'.format(request, e.message)
)
def validate(self, request):
try:
self._validator(request)
except fastjsonschema.exceptions.JsonSchemaException as e:
raise MalformedRequest(
'{} is invalid. Reason: {}'.format(request, e.message)
)
def validate(self, request):
try:
self._validator(request)
except fastjsonschema.exceptions.JsonSchemaException as e:
raise MalformedRequest(
'{} is invalid. Reason: {}'.format(request, e.message)
)
def validate(self, request):
try:
self._validator(request)
except fastjsonschema.exceptions.JsonSchemaException as e:
raise MalformedRequest(
'{} is invalid. Reason: {}'.format(request, e.message)
)
def validate(self, request):
try:
self._validator(request)
except fastjsonschema.exceptions.JsonSchemaException as e:
raise MalformedRequest(
'{} is invalid. Reason: {}'.format(request, e.message)
)
def api():
return DNACenterAPI(username=DNA_CENTER_USERNAME,
password=DNA_CENTER_PASSWORD,
encoded_auth=DNA_CENTER_ENCODED_AUTH,
base_url=DEFAULT_BASE_URL,
single_request_timeout=DEFAULT_SINGLE_REQUEST_TIMEOUT,
wait_on_rate_limit=DEFAULT_WAIT_ON_RATE_LIMIT,
verify=DEFAULT_VERIFY,
version=DNA_CENTER_VERSION)
def test_custom_base_url(self):
custom_url = "https://custom.domain.com/v1/"
with pytest.raises(dnacentersdk.exceptions.ApiError):
dnacentersdk.DNACenterAPI(username=DNA_CENTER_USERNAME,
password=DNA_CENTER_PASSWORD,
encoded_auth=DNA_CENTER_ENCODED_AUTH,
base_url=custom_url,
verify=DEFAULT_VERIFY,
version=DNA_CENTER_VERSION)
def test_custom_single_request_timeout(self):
custom_timeout = 10
connection_object = dnacentersdk.DNACenterAPI(username=DNA_CENTER_USERNAME,
password=DNA_CENTER_PASSWORD,
encoded_auth=DNA_CENTER_ENCODED_AUTH,
base_url=DEFAULT_BASE_URL,
single_request_timeout=custom_timeout,
verify=DEFAULT_VERIFY,
version=DNA_CENTER_VERSION)
assert connection_object.single_request_timeout == custom_timeout
def test_custom_base_url(self):
custom_url = "https://custom.domain.com/v1/"
with pytest.raises(dnacentersdk.exceptions.ApiError):
dnacentersdk.DNACenterAPI(username=DNA_CENTER_USERNAME,
password=DNA_CENTER_PASSWORD,
encoded_auth=DNA_CENTER_ENCODED_AUTH,
base_url=custom_url,
verify=DEFAULT_VERIFY,
version=DNA_CENTER_VERSION)