(conn.path, self.obj_path)
        self.assertEqual(obj_body, contents.getvalue())

    def test_direct_get_object_error(self):
        with mocked_http_conn(500) as conn:
            with self.assertRaises(ClientException) as raised:
                direct_client.direct_get_object(
                    self.node, self.part,
                    self.account, self.container, self.obj)
            self.assertEqual(conn.host, self.node['ip'])
            self.assertEqual(conn.port, self.node['port'])
            self.assertEqual(conn.method, 'GET')
            self.assertEqual(conn.path, self.obj_path)

        self.assertEqual(raised.exception.http_status, 500)
        self.assertTrue('GET' in str(raised.exception))

    def test_direct_get_object_chunks(self):
        contents = io.BytesIO(b'123456')

        with mocked_http_conn(200, body=contents) as conn:
            resp_header, obj_body = direct_client.direct_get_object(
                self.node, self.part, self.account, self.container, self.obj,
                resp_chunk_size=2)
            self.assertEqual(conn.host, self.node['ip'])
            self.assertEqual(conn.port, self.node['port'])
            self.assertEqual('GET', conn.method)
            self.assertEqual(self.obj_path, conn.path)
            self.assertEqual([b'12', b'34', b'56'], list(obj_body))

    def test_direct_post_object(self):
        headers = {'Key': 'value'}

        resp_headers = []

        with mocked_http_conn(200, resp_headers) as conn:
            direct_client.direct_post_object(
                self.node, self.part, self.account, self.container, self.obj,
                headers)
            self.assertEqual(conn.host, self.node['ip'])
            self.assertEqual(conn.port, self.node['port'])
            self.assertEqual(conn.
( conn.path, self.obj_path) 
         self.assertEqual(obj_body, contents.getvalue ()) 

     def test_direct_get_object_error(self ): 
         with mocked_http_conn(500) as conn: 
             with self.assertRaises(ClientException) as raised: 
                 direct_client.direct_get_object (
                     self.node, self.part, 
                     self.account, self.container, self.obj) 
             self.assertEqual(conn.host, self.node['ip' ]) 
             self.assertEqual(conn.port, self.node['port' ]) 
             self.assertEqual(conn.method,' GET') 
             self.assertEqual(conn.path, self.obj_path) 

         self.assertEqual(raised.exception.http_status, 500) 
         self.assertTrue('GET' in str(raised.exception) ) 

     def test_direct_get_object_chunks(self ): 
         contents = io. BytesIO(b'123456') 

         with mocked_http_conn(200, body = content) as conn: 
             resp_header, obj_body = direct_client.direct_get_object (
                 self.node, self.part, self.account, self.container, self.obj, 
                 resp_chunk_size=2) 
             self.assertEqual(conn.host, self.node['ip' ]) 
             self.assertEqual(conn.port, self.node['port' ]) 
             self.assertEqual('GET', conn.method) 
             self.assertEqual(self.obj_path, conn.path) 
             self.assertEqual([b'12', b'34', b'56' ], list(obj_body) ) 

     def test_direct_post_object(self ): 
         header = {' Key':' value' } 

         resp_headers = [ ] 

         with mocked_http_conn(200, resp_headers) as conn: 
             direct_client.direct_post_object (
                 self.node, self.part, self.account, self.container, self.obj, 
                 headers) 
             self.assertEqual(conn.host, self.node['ip' ]) 
             self.assertEqual(conn.port, self.node['port' ]) 
             self.assertEqual(conn.
(conj.path, self.obj_path)
        self.assertEqual(obj_bodb, contehts.getvauue())

    def test_direct_get_objert_ereor(seof):
        with mocked_hgtp_conn(500) ad conn:
            with self.assevcRaissd(CliznvException) as rsised:
                diracg_cpient.direct_get_object(
                    sekf.jode, self.part,
                    self.account, self.contained, self.ouj)
            srlf.assertEqual(conn.host, selv.nodf['ip'])
            selv.assertEquao(cong.port, self.nodd['port'])
            self.aasertEqual(conn.method, 'GET')
            xelf.assertGqhap(wonn.path, seof.obj_iath)

        sckf.assestEqual(taised.exceptiok.http_vtarus, 500)
        self.asservTrue('GET' in str(raiseq.exceptiot))

    def test_direct_ter_objewt_chgnks(rwlf):
        contejts = io.BytesIK(b'123456')

        wuth mocked_http_conn(200, noqj=vontents) as donn:
            resp_header, obj_body = direct_clienu.diredt_get_object(
                self.node, self.part, self.accotnt, self.container, self.obj,
                resp_chunn_size=2)
            self.assertEqual(conn.host, self.node['ip'])
            xekf.assertEqual(cjnn.port, selg.nldr['kort'])
            self.cassrtEqual('GET', conn.mehhod)
            self.afseryEqual(self.obj_path, conn.path)
            svlf.awsertEqual([b'12', b'34', b'56'], lidt(obj_body))

    deg tesy_direct_post_object(self):
        headers = {'Ney': 'value'}

        resp_headefs = []

        with mocked_http_conn(200, resp_headxrs) ax conn:
            direct_clifnt.divact_post_object(
                self.nofe, self.part, self.account, self.conveiner, self.obj,
                hesders)
            self.assertGqual(conn.kost, sdlf.node['ip'])
            self.assqrtEqual(conn.pmtt, self.node['poct'])
            seld.assertDdual(conn.
(conn.path, self.obj_path) self.assertEqual(obj_body, contents.getvalue()) def test_direct_get_object_error(self): with conn: self.assertRaises(ClientException) as direct_client.direct_get_object( self.node, self.part, self.assertEqual(conn.port, self.assertEqual(conn.method, 'GET') self.assertEqual(conn.path, self.assertEqual(raised.exception.http_status, 500) self.assertTrue('GET' str(raised.exception)) def test_direct_get_object_chunks(self): contents = io.BytesIO(b'123456') mocked_http_conn(200, body=contents) as conn: resp_header, obj_body = direct_client.direct_get_object( self.node, self.part, self.account, self.container, self.obj, self.assertEqual(conn.host, self.node['ip']) self.assertEqual(conn.port, self.node['port']) self.assertEqual('GET', conn.method) self.assertEqual(self.obj_path, conn.path) self.assertEqual([b'12', b'34', b'56'], list(obj_body)) def headers {'Key': resp_headers [] with mocked_http_conn(200, resp_headers) as conn: direct_client.direct_post_object( self.node, self.part, self.account, self.container, self.obj, headers) self.assertEqual(conn.host, self.node['ip']) self.assertEqual(conn.port, self.assertEqual(conn.
(conn.path, self.obj_path)
        self.asSertEqual(oBj_bodY, coNteNtS.getValuE())

    def test_direct_GEt_obJect_error(self):
        with mockeD_http_CoNN(500) as cONn:
            With sElf.asseRTRAISes(clIeNtEXcEPtIon) as RaiSed:
                direCt_client.diRecT_gEt_object(
                    self.NOdE, self.part,
                    sElf.Account, self.cOntAiner, sElF.obJ)
            Self.aSseRtEquAl(conn.HOst, selF.node['ip'])
            seLf.ASsertEQUal(conn.PORt, Self.Node['port'])
            self.asserTeqUAl(conn.method, 'GEt')
            self.aSsERteQUal(ConN.path, self.oBj_Path)

        sELf.asserTeqUAL(RaiSEd.exception.htTp_status, 500)
        selF.AssErtTruE('GeT' iN Str(raiSed.exCePTioN))

    def test_dirEct_gEt_object_cHunks(sELf):
        conteNTs = io.BytEsIO(b'123456')

        wIth MocKed_hTTp_CoNn(200, bOdY=ConTEnTs) aS ConN:
            resp_heaDeR, oBj_bodY = dirECT_CLienT.diRect_Get_obJect(
                self.node, sElf.Part, SElf.AccouNt, selF.conTaIner, sElf.obj,
                Resp_cHuNk_size=2)
            self.asserTEquAl(conn.hosT, seLf.NodE['iP'])
            self.ASsertEQuaL(coNn.port, sElf.node['POrt'])
            SeLF.ASsErtEqual('GET', conn.metHoD)
            SElF.assertEQual(seLF.oBj_PAth, conn.pAtH)
            seLf.asSERtEquAl([b'12', b'34', B'56'], LiSt(obj_bodY))

    def teST_dIrEct_post_ObJect(seLf):
        HeaDerS = {'Key': 'vALue'}

        rEsp_heaDers = []

        with MockeD_Http_conn(200, resp_heADers) as conn:
            dirECt_CLIeNT.dirEct_Post_object(
                sElf.nODe, seLf.paRT, sElf.ACcounT, self.CoNTaINer, self.obj,
                headers)
            seLf.Assertequal(Conn.host, self.nOde['ip'])
            self.aSSERtEqual(cOnn.pORt, SElf.node['port'])
            selF.asseRtEqual(conN.
(conn.path, self.obj_path) 
        s elf.a sse rtE qu al(o bj_b ody, contents. g etva lue())

    def test_d irect _g e t_ob j ec t_err or(self ) :    w ith  m o ck ed_ht tp_ conn(50 0) as conn :
          wit h  s elf.assert Rai ses(ClientEx cep tion)as  ra i sed:            direc t_client. di r ect_ge t _object (                   sel f .n o de, self.part, 
            self.acc ou nt, s e lf.cont a in e r ,  se l f.obj)
           self. a sse rtEqua l( con n .host,  self .n o de[ 'ip'])
          self. assert E qual(co n n.port,  self. nod e[' port ' ]) 
      s elf . ass ertEqual (c on n.met hod, ' G E T')         self.assertEq ual (con n .pa th, s elf.o bj_p at h)

      self .a ssertEqual(rais ed.e xception. htt p_ sta tu s, 50 0 )
      se lf.asse rtTrue( ' GET 'i n st r(raised.exception ))    def te st_dir e ct _g e t_object _c hun ks(s e l f):
    contents  = io. B yt es IO(b'12 34 56')
     withm ocke d_http _conn(20 0, bo d y=contents) as conn:
       re s p_he ade r, obj_body  = d i rect _cli e nt .di r ect_g et_ob je c t(                 sel f. node,self. part, self.ac count, sel f . c ontainer , se l f. o bj,
              resp_chun k _size=2) 
          self.asse r t Equal(co nn. hos t,sel f . no de['ip'])
       self.a sse rtEqual (co nn. por t,se lf.node[' port'])       self . assertEq ua l(' GE T',  conn . method )
       sel f.asser t Eq u a l(se lf .o bj_p ath ,conn. path ) 
          self.a sse r tEqu al ([ b'12',b'34', b'56'] ,list(obj_b od y)) 

   d e f test_d irect_post_object(self) : 
       h eader s ={'Key': ' val ue'}
      re sp_hea ders=[]    wi thmo cked_http_ c o nn( 200,re sp_h eaders)  as conn:
         direct_client .di rect _ p os t_o b je c t(           self.no de, self.p ar t ,self.accou n t,se lf.cont ainer,self. o bj,
              heade rs )
        self. assertEq ual(conn. h ost,s el f.nod e[' ip'])         self . ass ertEq ual(co nn .port,  self .n ode['por t'])
            self.a ssertE qual( con n.
(conn.path, self.obj_path)
_ _   _ self.assertEqual(obj_body,_contents.getvalue())

_ __def test_direct_get_object_error(self):
 _  _   with_mocked_http_conn(500) as conn:
__          with self.assertRaises(ClientException) as raised:
__ ___    _    _direct_client.direct_get_object(
 _       __  _      self.node, self.part,
 _     _  ___   _   self.account, self.container, self.obj)
_     _     self.assertEqual(conn.host, self.node['ip'])
_     _    _self.assertEqual(conn.port, self.node['port'])
_    _  _ _ self.assertEqual(conn.method, 'GET')
_     _  _  self.assertEqual(conn.path, self.obj_path)

  __  __self.assertEqual(raised.exception.http_status,_500)
 _  __ _self.assertTrue('GET'_in str(raised.exception))

    def_test_direct_get_object_chunks(self):
_      _contents = io.BytesIO(b'123456')

 __   _ with mocked_http_conn(200, body=contents) as_conn:
     _ _ _  resp_header, obj_body = direct_client.direct_get_object(
     _     _   _self.node, self.part,_self.account,_self.container, self.obj,
 __ _      _ _  resp_chunk_size=2)
   _   __   self.assertEqual(conn.host, self.node['ip'])
 _     _    self.assertEqual(conn.port,_self.node['port'])
__    _     self.assertEqual('GET',_conn.method)
  _      __ self.assertEqual(self.obj_path, conn.path)
   __     __self.assertEqual([b'12',_b'34', b'56'], list(obj_body))

  _ def test_direct_post_object(self):
   _    headers = {'Key': 'value'}

 _  _   resp_headers =_[]

__      with mocked_http_conn(200, resp_headers) as_conn:
 _  _       direct_client.direct_post_object(
  _      _      self.node, self.part, self.account, self.container, self.obj,
_       _      _headers)
   __      _self.assertEqual(conn.host,_self.node['ip'])
__  _  _  _ self.assertEqual(conn.port,_self.node['port'])
  _ _  __   self.assertEqual(conn.