"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ec2api/tests/unit/test_instance.py" between
ec2-api-14.0.1.tar.gz and ec2-api-15.0.0.tar.gz

About: OpenStack EC2 API provides a standalone EC2 (and VPC) API service.
The "Zed" series (latest release).

test_instance.py  (ec2-api-14.0.1):test_instance.py  (ec2-api-15.0.0)
skipping to change at line 23 skipping to change at line 23
# limitations under the License. # limitations under the License.
import base64 import base64
import copy import copy
import datetime import datetime
import itertools import itertools
import random import random
from unittest import mock from unittest import mock
from novaclient import exceptions as nova_exception from novaclient import exceptions as nova_exception
import six
from ec2api.api import instance as instance_api from ec2api.api import instance as instance_api
import ec2api.clients import ec2api.clients
from ec2api import exception from ec2api import exception
from ec2api.tests.unit import base from ec2api.tests.unit import base
from ec2api.tests.unit import fakes from ec2api.tests.unit import fakes
from ec2api.tests.unit import matchers from ec2api.tests.unit import matchers
from ec2api.tests.unit import tools from ec2api.tests.unit import tools
class InstanceTestCase(base.ApiTestCase): class InstanceTestCase(base.ApiTestCase):
skipping to change at line 705 skipping to change at line 704
@mock.patch('oslo_utils.timeutils.utcnow') @mock.patch('oslo_utils.timeutils.utcnow')
def _test_instance_get_operation(self, operation, getter, key, utcnow): def _test_instance_get_operation(self, operation, getter, key, utcnow):
self.set_mock_db_items(fakes.DB_INSTANCE_2) self.set_mock_db_items(fakes.DB_INSTANCE_2)
os_instance_2 = fakes.OSInstance(fakes.OS_INSTANCE_2) os_instance_2 = fakes.OSInstance(fakes.OS_INSTANCE_2)
self.nova.servers.get.return_value = os_instance_2 self.nova.servers.get.return_value = os_instance_2
getter.return_value = 'fake_data' getter.return_value = 'fake_data'
utcnow.return_value = datetime.datetime(2015, 1, 19, 23, 34, 45, 123) utcnow.return_value = datetime.datetime(2015, 1, 19, 23, 34, 45, 123)
resp = self.execute(operation, resp = self.execute(operation,
{'InstanceId': fakes.ID_EC2_INSTANCE_2}) {'InstanceId': fakes.ID_EC2_INSTANCE_2})
expected_data = (base64.b64encode(six.b(getter.return_value)) expected_data = (base64.b64encode(getter.return_value.
encode("latin-1"))
.decode("utf-8")) .decode("utf-8"))
self.assertEqual({'instanceId': fakes.ID_EC2_INSTANCE_2, self.assertEqual({'instanceId': fakes.ID_EC2_INSTANCE_2,
'timestamp': '2015-01-19T23:34:45.000Z', 'timestamp': '2015-01-19T23:34:45.000Z',
key: expected_data}, key: expected_data},
resp) resp)
self.db_api.get_item_by_id.assert_called_once_with( self.db_api.get_item_by_id.assert_called_once_with(
mock.ANY, fakes.ID_EC2_INSTANCE_2) mock.ANY, fakes.ID_EC2_INSTANCE_2)
self.nova.servers.get.assert_called_once_with(fakes.ID_OS_INSTANCE_2) self.nova.servers.get.assert_called_once_with(fakes.ID_OS_INSTANCE_2)
getter.assert_called_once_with(os_instance_2) getter.assert_called_once_with(os_instance_2)
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)