コード例 #1
0
ファイル: Registration_t.py プロジェクト: zhiwenuil/WMCore
    def testPush(self):
        reg_info ={
                   "location": "https://globaldbs",
                   "admin": "*****@*****.**",
                   "type": "DBS",
                   "name": "Global DBS",
                   "timeout": 2
        }

        reg = Registration({'server': self.testInit.couchUrl, 'database': self.couch_db}, reg_info)

        json = BasicAuthJSONRequests(self.testInit.couchUrl)
        data = json.get('/%s/%s' % (self.couch_db, str(reg_info['location'].__hash__())))
        for k, v in reg_info.items():
            if k != 'timestamp':
                assert data[0][k] == v, \
                "Registration incomplete: %s should equal %s for key %s" % (data[0][k], v, k)
コード例 #2
0
ファイル: Registration_t.py プロジェクト: tsarangi/WMCore
    def testPush(self):
        reg_info = {
            "location": "https://globaldbs",
            "admin": "*****@*****.**",
            "type": "DBS",
            "name": "Global DBS",
            "timeout": 2
        }

        reg = Registration(
            {
                'server': self.testInit.couchUrl,
                'database': self.couch_db
            }, reg_info)

        json = BasicAuthJSONRequests(self.testInit.couchUrl)
        data = json.get('/%s/%s' %
                        (self.couch_db, str(reg_info['location'].__hash__())))
        for k, v in reg_info.items():
            if k != 'timestamp':
                assert data[0][k] == v, \
                "Registration incomplete: %s should equal %s for key %s" % (data[0][k], v, k)
コード例 #3
0
ファイル: CMSCouch.py プロジェクト: dmwm/WMCore-legacy
 def makeRequest(self,
                 uri=None,
                 data=None,
                 type='GET',
                 incoming_headers={},
                 encode=True,
                 decode=True,
                 contentType=None,
                 cache=False):
     """
     Make the request, handle any failed status, return just the data (for 
     compatibility). By default do not cache the response.
     
     TODO: set caching in the calling methods.
     """
     try:
         if not cache:
             incoming_headers.update({'Cache-Control': 'no-cache'})
         result, status, reason, cached = BasicAuthJSONRequests.makeRequest(
             self, uri, data, type, incoming_headers, encode, decode,
             contentType)
     except HTTPException, e:
         self.checkForCouchError(getattr(e, "status", None),
                                 getattr(e, "reason", None), data)
コード例 #4
0
ファイル: CMSCouch.py プロジェクト: dmwm/WMCore-legacy
 def __init__(self, url='http://localhost:5984'):
     """
     Initialise requests
     """
     BasicAuthJSONRequests.__init__(self, url)
     self.accept_type = "application/json"