Exemple #1
0
 def test_price_delete(self):
     json = self.post_json('/prices', utils.get_test_price()).json
     url = '/prices/%s' % (json['id'])
     self.delete(url)
     response = self.get_json(url, expect_errors=True)
     self.assertEqual(response.status_int, 404)
     self.assertEqual(response.content_type, 'application/json')
     self.assertTrue(response.json['error_message'])
Exemple #2
0
 def test_price_delete(self):
     json = self.post_json('/prices', utils.get_test_price()).json
     url = '/prices/%s' % (json['id'])
     self.delete(url)
     response = self.get_json(url, expect_errors=True)
     self.assertEqual(response.status_int, 404)
     self.assertEqual(response.content_type, 'application/json')
     self.assertTrue(response.json['error_message'])
Exemple #3
0
    def test_price_create(self):
        json = self.post_json('/prices', utils.get_test_price()).json
        expect = {
            "resource_type": "volume",
            "region": "regionOne",
            "unit_price": 1
        }

        for key, value in expect.items():
            self.assertEqual(json[key], value)

        url = '/prices/' + str(json['id'])
        json = self.get_json(url)

        for key, value in expect.items():
            self.assertEqual(json[key], value)
Exemple #4
0
    def test_price_create(self):
        json = self.post_json('/prices', utils.get_test_price()).json
        expect = {
            "resource_type": "volume",
            "region": "regionOne",
            "unit_price": 1
        }

        for key, value in expect.items():
            self.assertEqual(json[key], value)

        url = '/prices/' + str(json['id'])
        json = self.get_json(url)

        for key, value in expect.items():
            self.assertEqual(json[key], value)
Exemple #5
0
 def test_price_update(self):
     json = self.post_json('/prices', utils.get_test_price()).json
     url = '/prices/%s' % (json['id'])
     self.put_json('/prices', {'id': json['id'], 'unit_price': 2})
     json = self.get_json(url)
     self.assertEqual(json['unit_price'], 2)
Exemple #6
0
 def _create_test_price(self, **kwargs):
     price = utils.get_test_price(**kwargs)
     result = self.dbapi.price_create(price)
     return result
 def _create_test_price(self, **kwargs):
     price = utils.get_test_price(**kwargs)
     result = self.dbapi.price_create(price)
     return result
Exemple #8
0
 def test_price_update(self):
     json = self.post_json('/prices', utils.get_test_price()).json
     url = '/prices/%s' % (json['id'])
     self.put_json('/prices', {'id': json['id'], 'unit_price': 2})
     json = self.get_json(url)
     self.assertEqual(json['unit_price'], 2)