Ejemplo n.º 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'])
Ejemplo n.º 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'])
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 6
0
 def _create_test_price(self, **kwargs):
     price = utils.get_test_price(**kwargs)
     result = self.dbapi.price_create(price)
     return result
Ejemplo n.º 7
0
 def _create_test_price(self, **kwargs):
     price = utils.get_test_price(**kwargs)
     result = self.dbapi.price_create(price)
     return result
Ejemplo n.º 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)