Repository URL to install this package:
Version:
4.2.64.2 ▾
|
ó [dc @ sÓ d d l m Z d d l m Z d d l Z d d l m Z e j e Z d e f d YZ d e f d YZ d e f d YZ d e f d YZ d e f d YZ d e f d YZ d S( iÿÿÿÿ( t log( t jsonutilsN( t parset APIResponsec B s8 e Z d Z d Z d Z i Z i Z d Z d Z RS( s3 Decoded API Response This provides a decoded version of the Requests response which include a json decoded body, far more convenient for testing that returned structures are correct, or using parts of returned structures in tests. This class is a simple wrapper around dictionaries for API responses in tests. It includes extra attributes so that they can be inspected in addition to the attributes. All json responses from Nova APIs are dictionary compatible, or blank, so other possible base classes are not needed. iÈ t c C s¢ t t | j | j | _ | j | _ | j r | j j d } d | k rd | j | _ q d | k r | j | _ q t d | n | j | _ d S( su Construct an API response from a Requests response :param response: a ``requests`` library response s content-types application/jsons text/htmls$ Unexpected response content-type: %sN( t superR t __init__t status_codet statust contentt headerst gett jsont bodyt textt ValueError( t selft responset content_type( ( sE /usr/lib/python2.7/dist-packages/dmapi/tests/functional/api/client.pyR ' s c C s d | j | j f S( Ns" <Response body:%r, status_code:%s>( R R ( R ( ( sE /usr/lib/python2.7/dist-packages/dmapi/tests/functional/api/client.pyt __str__= s ( t __name__t __module__t __doc__R R R R R R ( ( ( sE /usr/lib/python2.7/dist-packages/dmapi/tests/functional/api/client.pyR s t OpenStackApiExceptionc B s e Z d d d Z RS( c C sl | | _ | s d } n | rR | j } | j } d i | d 6| d 6| d 6} n t t | j | d S( Ns Unspecified errors4 %(message)s Status Code: %(_status)s Body: %(_body)st messaget _statust _body( R R R R R R ( R R R R R ( ( sE /usr/lib/python2.7/dist-packages/dmapi/tests/functional/api/client.pyR D s N( R R t NoneR ( ( ( sE /usr/lib/python2.7/dist-packages/dmapi/tests/functional/api/client.pyR C s t# OpenStackApiAuthenticationExceptionc B s e Z d d d Z RS( c C s, | s d } n t t | j | | d S( Ns Authentication error( R R R ( R R R ( ( sE /usr/lib/python2.7/dist-packages/dmapi/tests/functional/api/client.pyR V s N( R R R R ( ( ( sE /usr/lib/python2.7/dist-packages/dmapi/tests/functional/api/client.pyR U s t" OpenStackApiAuthorizationExceptionc B s e Z d d d Z RS( c C s, | s d } n t t | j | | d S( Ns Authorization error( R R R ( R R R ( ( sE /usr/lib/python2.7/dist-packages/dmapi/tests/functional/api/client.pyR ^ s N( R R R R ( ( ( sE /usr/lib/python2.7/dist-packages/dmapi/tests/functional/api/client.pyR ] s t OpenStackApiNotFoundExceptionc B s e Z d d d Z RS( c C s, | s d } n t t | j | | d S( Ns Item not found( R R R ( R R R ( ( sE /usr/lib/python2.7/dist-packages/dmapi/tests/functional/api/client.pyR f s N( R R R R ( ( ( sE /usr/lib/python2.7/dist-packages/dmapi/tests/functional/api/client.pyR e s t TestOpenStackClientc B su e Z d Z dB d Z d dB dB d Z d d Z dB e d Z d Z d Z d Z d Z d Z d Z e dB d Z d Z d Z d Z d Z d Z d Z e d Z d Z d Z d Z d Z e d Z d Z d Z d Z d Z e d Z! d Z" d Z# d! Z$ e d" Z% d# Z&