Example #1
0
    def test_list(self, mock_resource_manager__manager):
        ip_range = [mock.MagicMock(), mock.MagicMock(), mock.MagicMock()]
        ip_range[0].pool = "a"
        ip_range[1].pool = "rally_fip_pool_a"
        ip_range[2].pool = "rally_fip_pool_b"

        mock_resource_manager__manager().list.return_value = ip_range
        self.assertEqual(ip_range[1:], resources.NovaFloatingIpsBulk().list())
Example #2
0
    def test_list(self, mock_name_matches_object,
                  mock_resource_manager__manager):
        ip_range = [mock.MagicMock(), mock.MagicMock(), mock.MagicMock()]
        ip_range[0].pool = "a"
        ip_range[1].pool = "rally_fip_pool_a"
        ip_range[2].pool = "rally_fip_pool_b"
        mock_name_matches_object.side_effect = (lambda n, o:
                                                n.startswith("rally"))

        mock_resource_manager__manager().list.return_value = ip_range
        self.assertEqual(ip_range[1:], resources.NovaFloatingIpsBulk().list())
Example #3
0
 def test_id(self):
     ip_range = resources.NovaFloatingIpsBulk()
     ip_range.raw_resource = mock.MagicMock()
     self.assertEqual(ip_range.raw_resource.address, ip_range.id())