コード例 #1
0
 def test_basic(self):
     sot = gateway.Gateway()
     self.assertEqual('nat_gateway', sot.resource_key)
     self.assertEqual('nat_gateways', sot.resources_key)
     path = '/nat_gateways'
     self.assertEqual(path, sot.base_path)
     self.assertTrue(sot.allow_list)
     self.assertTrue(sot.allow_create)
     self.assertTrue(sot.allow_fetch)
     self.assertTrue(sot.allow_commit)
     self.assertTrue(sot.allow_delete)
コード例 #2
0
 def test_make_it(self):
     sot = gateway.Gateway(**EXAMPLE)
     self.assertEqual(EXAMPLE['router_id'], sot.router_id)
     self.assertEqual(EXAMPLE['status'], sot.status)
     self.assertEqual(EXAMPLE['description'], sot.description)
     self.assertEqual(EXAMPLE['admin_state_up'], sot.admin_state_up)
     self.assertEqual(EXAMPLE['project_id'], sot.project_id)
     self.assertEqual(EXAMPLE['created_at'], sot.created_at)
     self.assertEqual(EXAMPLE['spec'], sot.spec)
     self.assertEqual(EXAMPLE['internal_network_id'],
                      sot.internal_network_id)
     self.assertEqual(EXAMPLE['id'], sot.id)
     self.assertEqual(EXAMPLE['name'], sot.name)
コード例 #3
0
ファイル: fakes.py プロジェクト: zsoltn/python-otcextensions
    def generate(cls):
        """Create a fake NAT Gateway.

        :return:
            A FakeResource object, with id, name and so on
        """
        # Set default attributes.
        object_info = {
            "id": "id-" + uuid.uuid4().hex,
            "name": "name-" + uuid.uuid4().hex,
            "router_id": "router-" + uuid.uuid4().hex,
            "status": "PENDING_CREATE",
            "description": "my nat gateway",
            "admin_state_up": 'true',
            "tenant_id": "tenant-id-" + uuid.uuid4().hex,
            "created_at": datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f"),
            "spec": "1",
            "internal_network_id": "net-id-" + uuid.uuid4().hex
        }

        return gateway.Gateway(**object_info)