summaryrefslogtreecommitdiff
path: root/functionaltests
diff options
context:
space:
mode:
authorFernando Diaz <diazjf@us.ibm.com>2015-08-26 11:37:18 -0500
committerFernando Diaz <diazjf@us.ibm.com>2015-09-02 23:59:27 -0500
commita4e224e4089b71c44ae6b3401b86f1691190454d (patch)
treeb7951369702b1b475c6db986319f2a02cd03d05d /functionaltests
parent0771bb8d5e1747df6b929d2473f97e687d9e3963 (diff)
downloadpython-barbicanclient-a4e224e4089b71c44ae6b3401b86f1691190454d.tar.gz
Remove test behaviors abstraction for orders smoke tests
Will remove the test behaviors abstraction from orders smoke tests. Tests will be rewritten to use the barbican-client directly. Change-Id: I5d60c01055cf31f6dbbb24bae5f57c04c453d5f5
Diffstat (limited to 'functionaltests')
-rw-r--r--functionaltests/client/v1/smoke/test_orders.py60
1 files changed, 32 insertions, 28 deletions
diff --git a/functionaltests/client/v1/smoke/test_orders.py b/functionaltests/client/v1/smoke/test_orders.py
index 8d85cfc..ceaefb8 100644
--- a/functionaltests/client/v1/smoke/test_orders.py
+++ b/functionaltests/client/v1/smoke/test_orders.py
@@ -16,7 +16,7 @@ from testtools import testcase
from functionaltests import utils
from functionaltests.client import base
-from functionaltests.client.v1.behaviors import order_behaviors
+from functionaltests.common import cleanup
order_create_key_data = {
@@ -50,19 +50,18 @@ class OrdersTestCase(base.TestCase):
def setUp(self):
super(OrdersTestCase, self).setUp()
- self.behaviors = order_behaviors.OrderBehaviors(
- self.barbicanclient)
+ self.cleanup = cleanup.CleanUp(self.barbicanclient)
def tearDown(self):
- self.behaviors.delete_all_created_orders()
+ self.cleanup.delete_all_entities()
super(OrdersTestCase, self).tearDown()
@testcase.attr('positive')
def test_create_order_defaults(self):
"""Covers simple order creation."""
-
- test_model = self.behaviors.create_key_order(order_create_key_data)
- order_ref = self.behaviors.store_order(test_model)
+ order = self.barbicanclient.orders.create_key(
+ **order_create_key_data)
+ order_ref = self.cleanup.add_entity(order)
self.assertIsNotNone(order_ref)
@@ -74,14 +73,15 @@ class OrdersTestCase(base.TestCase):
"""
# first create an order
- test_model = self.behaviors.create_key_order(order_create_key_data)
- order_ref = self.behaviors.store_order(test_model)
+ order = self.barbicanclient.orders.create_key(
+ **order_create_key_data)
+ order_ref = self.cleanup.add_entity(order)
# verify that the order was created successfully
self.assertIsNotNone(order_ref)
# given the order href, retrieve the order
- order_resp = self.behaviors.get_order(order_ref)
+ order_resp = self.barbicanclient.orders.get(order_ref)
# verify that the get was successful
self.assertTrue(order_resp.status == "ACTIVE" or
@@ -89,13 +89,13 @@ class OrdersTestCase(base.TestCase):
# verify the metadata
self.assertEqual(order_resp.name,
- test_model.name)
+ order.name)
self.assertEqual(order_resp.mode,
- test_model.mode)
+ order.mode)
self.assertEqual(order_resp.algorithm,
- test_model.algorithm)
+ order.algorithm)
self.assertEqual(order_resp.bit_length,
- test_model.bit_length)
+ order.bit_length)
@testcase.attr('positive')
def test_get_order_defaults(self):
@@ -105,13 +105,13 @@ class OrdersTestCase(base.TestCase):
"""
# create an order
- test_model = self.behaviors.create_key_order(
- order_create_key_data)
- order_ref = self.behaviors.store_order(test_model)
+ order = self.barbicanclient.orders.create_key(
+ **order_create_key_data)
+ order_ref = self.cleanup.add_entity(order)
self.assertIsNotNone(order_ref)
# get the order
- order_resp = self.behaviors.get_order(order_ref)
+ order_resp = self.barbicanclient.orders.get(order_ref)
# verify the order
self.assertIsNotNone(order_resp.order_ref)
@@ -127,14 +127,18 @@ class OrdersTestCase(base.TestCase):
"""Covers simple order deletion."""
# create an order
- test_model = self.behaviors.create_key_order(
- order_create_key_data)
- order_ref = self.behaviors.store_order(test_model)
+ order = self.barbicanclient.orders.create_key(
+ **order_create_key_data)
+ order_ref = order.submit()
+ secret_ref = self.barbicanclient.orders.get(order_ref).secret_ref
# delete the order
- delete_resp = self.behaviors.delete_order(order_ref)
+ delete_resp = self.barbicanclient.orders.delete(order_ref)
self.assertIsNone(delete_resp)
+ # delete the secret
+ self.barbicanclient.secrets.delete(secret_ref)
+
@testcase.attr('positive')
def test_get_orders_defaults(self):
"""Covers getting a list of orders."""
@@ -144,14 +148,14 @@ class OrdersTestCase(base.TestCase):
# create the orders
for i in range(0, total + 1):
- test_model = self.behaviors.create_key_order(
- order_create_key_data)
- order_ref = self.behaviors.store_order(test_model)
+ order = self.barbicanclient.orders.create_key(
+ **order_create_key_data)
+ order_ref = self.cleanup.add_entity(order)
self.assertIsNotNone(order_ref)
# get a list of orders
- orders_list = self.behaviors.get_orders(
- limit=limit, offset=offset)
+ orders_list = self.barbicanclient.orders.list(limit=limit,
+ offset=offset)
- # verify that the get for the list was successfu
+ # verify that the get for the list was successful
self.assertEqual(len(orders_list), limit)