コード例 #1
0
 def test_fault(self):
     view = InstanceDetailView(self.instance, self.req)
     result = view.data()
     self.assertEqual(self.fault_message,
                      result['instance']['fault']['message'])
     self.assertEqual(self.fault_details,
                      result['instance']['fault']['details'])
     self.assertEqual(self.fault_date,
                      result['instance']['fault']['created'])
コード例 #2
0
ファイル: test_instance_views.py プロジェクト: Hyewoen/trove
 def test_fault(self):
     view = InstanceDetailView(self.instance, self.req)
     result = view.data()
     self.assertEqual(self.fault_message,
                      result['instance']['fault']['message'])
     self.assertEqual(self.fault_details,
                      result['instance']['fault']['details'])
     self.assertEqual(self.fault_date,
                      result['instance']['fault']['created'])
コード例 #3
0
ファイル: test_instance_views.py プロジェクト: vdialani/trove
 def test_data_ip(self):
     self.instance.hostname = None
     view = InstanceDetailView(self.instance, Mock())
     result = view.data()
     self.assertEqual(self.instance.created, result['instance']['created'])
     self.assertEqual(self.instance.updated, result['instance']['updated'])
     self.assertEqual(self.instance.datastore_version.name,
                      result['instance']['datastore']['version'])
     self.assertNotIn('hostname', result['instance'])
     self.assertEqual([self.ip], result['instance']['ip'])
コード例 #4
0
 def test_data_ip(self):
     self.instance.hostname = None
     view = InstanceDetailView(self.instance, self.req)
     result = view.data()
     self.assertEqual(self.instance.created, result['instance']['created'])
     self.assertEqual(self.instance.updated, result['instance']['updated'])
     self.assertEqual(self.instance.datastore_version.name,
                      result['instance']['datastore']['version'])
     self.assertNotIn('hostname', result['instance'])
     self.assertEqual([self.ip], result['instance']['ip'])
コード例 #5
0
 def test_data_hostname(self):
     view = InstanceDetailView(self.instance, Mock())
     result = view.data()
     self.assertEqual(self.instance.created, result['instance']['created'])
     self.assertEqual(self.instance.updated, result['instance']['updated'])
     self.assertEqual(self.instance.datastore_version.name,
                      result['instance']['datastore']['version'])
     self.assertEqual(self.instance.hostname,
                      result['instance']['hostname'])
     self.assertNotIn('ip', result['instance'])
コード例 #6
0
ファイル: test_instance_views.py プロジェクト: Hyewoen/trove
 def test_data_hostname(self):
     view = InstanceDetailView(self.instance, self.req)
     result = view.data()
     self.assertEqual(self.instance.created, result['instance']['created'])
     self.assertEqual(self.instance.updated, result['instance']['updated'])
     self.assertEqual(self.instance.datastore_version.name,
                      result['instance']['datastore']['version'])
     self.assertEqual(self.instance.hostname,
                      result['instance']['hostname'])
     self.assertNotIn('ip', result['instance'])
コード例 #7
0
    def test_access(self):
        instance = MagicMock()
        instance.hostname = None
        instance.get_visible_ip_addresses.return_value = [{
            'address': '10.111.0.27',
            'type': 'private'
        }]
        instance.access = None
        instance.slaves = []

        view = InstanceDetailView(instance, self.req)
        data = view.data()['instance']

        self.assertFalse(data['access']['is_public'])

        instance.get_visible_ip_addresses.return_value = [{
            'address': '10.111.0.27',
            'type': 'private'
        }, {
            'address': '172.30.5.107',
            'type': 'public'
        }]

        view = InstanceDetailView(instance, self.req)
        data = view.data()['instance']

        self.assertTrue(data['access']['is_public'])
コード例 #8
0
 def test_non_admin_view(self):
     self.context.is_admin = False
     view = InstanceDetailView(self.instance, self.req)
     result = view.data()
     self.assertNotIn('server_id', result['instance'])
     self.assertNotIn('volume_id', result['instance'])
コード例 #9
0
 def test_locality(self):
     self.instance.hostname = None
     view = InstanceDetailView(self.instance, self.req)
     result = view.data()
     self.assertEqual(self.instance.locality,
                      result['instance']['locality'])
コード例 #10
0
ファイル: test_instance_views.py プロジェクト: Hyewoen/trove
 def test_non_admin_view(self):
     self.context.is_admin = False
     view = InstanceDetailView(self.instance, self.req)
     result = view.data()
     self.assertNotIn('server_id', result['instance'])
     self.assertNotIn('volume_id', result['instance'])
コード例 #11
0
ファイル: test_instance_views.py プロジェクト: Hyewoen/trove
 def test_locality(self):
     self.instance.hostname = None
     view = InstanceDetailView(self.instance, self.req)
     result = view.data()
     self.assertEqual(self.instance.locality,
                      result['instance']['locality'])