예제 #1
0
 def test_unauthorized_response(self):
     http_response = MockResponse(httplib.UNAUTHORIZED,
                                  OpenNebula_ResponseTests.XML,
                                  headers={'content-type':
                                           'application/xml'})
     try:
         OpenNebulaResponse(http_response, None).parse_body()
     except InvalidCredsError:
         exceptionType = sys.exc_info()[0]
         self.assertEqual(exceptionType, type(InvalidCredsError()))
예제 #2
0
 def upload_file(self,
                 object_name=None,
                 content_type=None,
                 request_path=None,
                 request_method=None,
                 headers=None,
                 file_path=None,
                 stream=None):
     return {
         'response': MockResponse(200),
         'bytes_transferred': 1000,
         'data_hash': 'hash343hhash89h932439jsaa89'
     }
예제 #3
0
 def upload_file(self,
                 object_name=None,
                 content_type=None,
                 request_path=None,
                 request_method=None,
                 headers=None,
                 file_path=None,
                 stream=None):
     return {
         'response': MockResponse(200, headers={'etag':
                                                'woopwoopwoop'}),
         'bytes_transferred': 1000,
         'data_hash': '0cc175b9c0f1b6a831c399e269772661'
     }
예제 #4
0
 def test_base_response(self):
     Response(MockResponse(status=200, body='foo'), ConnectionKey('foo'))