Beispiel #1
0
        self.set_http_response(status_code=200)
        tasks = self.service_connection.describe_export_tasks([self.TASK_ID])
        self.assert_request_parameters({
            "Action": "DescribeExportTasks",
            "ExportTaskId.1": "i-task"
        }, self.ignore_params_values)

        self.assertEquals(len(tasks), 1)
        task = tasks[0]
        self.assertIsInstance(task, ExportTask)
        self.assertEquals(task.id, self.TASK_ID)
        self.assertEquals(task.instance_id, "i-instance")
        self.assertEquals(len(task.volume_export_details), 1)
        volume = task.volume_export_details[0]
        self.assertIsInstance(volume, ExportVolumeTask)
        self.assertEquals(volume.volume_id, "i-volume")

    def test_cancel_export_task(self):
        self.set_http_response(status_code=200)

        resp = self.service_connection.cancel_export_task(self.TASK_ID)
        self.assert_request_parameters({
            "Action": "CancelExportTask",
            "ExportTaskId": "i-task"
        }, self.ignore_params_values)
        self.assertTrue(resp)


if __name__ == "__main__":
    unittest.main()
        self.assertNotEqual(west_2, None, "Couldn't find the us-west-2 region!")
        self.assertTrue(isinstance(west_2, RegionInfo))
        self.assertEqual(west_2.name, 'us-west-2')
        self.assertEqual(west_2.endpoint, 'ec2.us-west-2.amazonaws.com')
        self.assertEqual(west_2.connection_cls, None)

    def test_get_regions_overrides(self):
        ec2_regions = get_regions(
            'ec2',
            region_cls=TestRegionInfo,
            connection_cls=FakeConn
        )
        self.assertTrue(len(ec2_regions) >= 10)
        west_2 = None

        for region_info in ec2_regions:
            if region_info.name == 'us-west-2':
                west_2 = region_info
                break

        self.assertNotEqual(west_2, None, "Couldn't find the us-west-2 region!")
        self.assertFalse(isinstance(west_2, RegionInfo))
        self.assertTrue(isinstance(west_2, TestRegionInfo))
        self.assertEqual(west_2.name, 'us-west-2')
        self.assertEqual(west_2.endpoint, 'ec2.us-west-2.amazonaws.com')
        self.assertEqual(west_2.connection_cls, FakeConn)


if __name__ == '__main__':
    unittest.main()
        # id of the ec2 instance).
        self.assertEqual(instance.id, 'i-ff0f1299')
        self.assertDictEqual(
            instance.instance_profile,
            {'arn': ('arn:aws:iam::ownerid:'
                     'instance-profile/myinstanceprofile'),
             'id': 'iamid'})
class TestDescribeInstances(AWSMockServiceTestCase):
    connection_class = EC2Connection
    def default_body(self):
        return DESCRIBE_INSTANCE_VPC
    def test_multiple_private_ip_addresses(self):
        self.set_http_response(status_code=200)
        api_response = self.service_connection.get_all_instances()
        self.assertEqual(len(api_response), 1)
        instances = api_response[0].instances
        self.assertEqual(len(instances), 1)
        instance = instances[0]
        self.assertEqual(len(instance.interfaces), 1)
        interface = instance.interfaces[0]
        self.assertEqual(len(interface.private_ip_addresses), 3)
        addresses = interface.private_ip_addresses
        self.assertEqual(addresses[0].private_ip_address, '10.0.0.67')
        self.assertTrue(addresses[0].primary)
        self.assertEqual(addresses[1].private_ip_address, '10.0.0.54')
        self.assertFalse(addresses[1].primary)
        self.assertEqual(addresses[2].private_ip_address, '10.0.0.55')
        self.assertFalse(addresses[2].primary)
if __name__ == '__main__':
    unittest.main(
class ScarlettSystemTestCase(ScarlettTestCase):

    def setUp(self):
        super(ScarlettSystemTestCase, self).setUp()

    @attr(scarlettsystem=True, dbus=True)
    def test_scarlett_system(self):
        ss_test = scarlett.ScarlettSystem()
        self.assertTrue(
            'Scarlett 0.5.0 (linux2)' in ss_test.scarlett_version_info, True)
        self.assertTrue('Python 2.7.3' in ss_test.scarlett_version_info, True)
        self.assertTrue('PyGst 0.10' in ss_test.scarlett_version_info, True)
        self.assertTrue(
            'Gobject (2, 32, 4)' in ss_test.scarlett_version_info, True)
        self.assertTrue(
            'org.scarlettapp.scarlettdaemon' in ss_test.DBUS_NAME, True)
        self.assertTrue(
            '/org/scarlettapp/scarlettdaemon' in ss_test.DBUS_PATH, True)
        self.assertEqual(ss_test.brain, None)
        self.assertEqual(ss_test.player, None)
        self.assertEqual(ss_test.speaker, None)
        self.assertEqual(ss_test.base_services, [])
        self.assertEqual(ss_test.features, [])


def suite():
    return unittest.TestLoader().loadTestsFromName(__name__)

if __name__ == '__main__':
    unittest.main(defaultTest='suite')
Beispiel #5
0
# This file is part of Scarlett.
# Copyright 2014, Behanceops.

import sys
import time
import datetime
from tests.unit import unittest
from nose.plugins.attrib import attr


class GstImprovedTest(unittest.TestCase):
    def setUp(self):
        super(GstImprovedTest, self).setUp()

    @attr('notdefault', 'gst_improved')
    def test_gi(self):
        import gi
        gi.require_version('Gst', '1.0')
        from gi.repository import Gst
        self.assertTrue(Gst.version_string(), 'GStreamer 1.2.1')


def suite():
    return unittest.TestLoader().loadTestsFromName(__name__)


if __name__ == '__main__':
    unittest.main(defaultTest='suite')