示例#1
0
    def test_patch_claim_invalid_ttl(self, ttl):
        """Patch Claim with invalid TTL.

        The request JSON body will have a TTL value
        outside the allowed range.Allowed ttl values is
        60 <= ttl <= 43200.
        """
        doc = '{"ttl": 100, "grace": 100}'

        result = http.post(self.claim_url, self.header, doc)
        self.assertEqual(result.status_code, 201)

        #Extract claim location and construct the claim URL.
        location = result.headers['Location']
        url = self.cfg.base_server + location

        #Patch Claim.
        doc = {"ttl": ttl}
        result = http.patch(url, self.header, json.dumps(doc))
        self.assertEqual(result.status_code, 400)
示例#2
0
    def test_patch_claim_invalid_ttl(self, ttl):
        """Patch Claim with invalid TTL.

        The request JSON body will have a TTL value
        outside the allowed range.Allowed ttl values is
        60 <= ttl <= 43200.
        """
        doc = '{"ttl": 100, "grace": 100}'

        result = http.post(self.claim_url, self.header, doc)
        self.assertEqual(result.status_code, 201)

        #Extract claim location and construct the claim URL.
        location = result.headers['Location']
        url = self.cfg.base_server + location

        #Patch Claim.
        doc = {"ttl": ttl}
        result = http.patch(url, self.header, json.dumps(doc))
        self.assertEqual(result.status_code, 400)
示例#3
0
    def test_claim_patch(self):
        """Update Claim."""
        #Test Setup - Post Claim
        doc = '{"ttl": 300, "grace": 400}'

        result = http.post(self.claim_url, self.header, doc)
        self.assertEqual(result.status_code, 201)

        #Patch Claim
        claim_location = result.headers['Location']
        url = self.cfg.base_server + claim_location
        doc_updated = '{"ttl": 300}'

        result = http.patch(url, self.header, doc_updated)
        self.assertEqual(result.status_code, 204)

        #verify that the claim TTL is updated
        result = http.get(url, self.header)
        new_ttl = result.json()['ttl']
        self.assertEqual(new_ttl, 300)
示例#4
0
    def test_claim_patch(self):
        """Update Claim."""
        #Test Setup - Post Claim
        doc = '{"ttl": 300, "grace": 400}'

        result = http.post(self.claim_url, self.header, doc)
        self.assertEqual(result.status_code, 201)

        #Patch Claim
        claim_location = result.headers['Location']
        url = self.cfg.base_server + claim_location
        doc_updated = '{"ttl": 300}'

        result = http.patch(url, self.header, doc_updated)
        self.assertEqual(result.status_code, 204)

        #verify that the claim TTL is updated
        result = http.get(url, self.header)
        new_ttl = result.json()['ttl']
        self.assertEqual(new_ttl, 300)