Ejemplo n.º 1
0
 def test_deregist_instance(self):
     with mock.patch(
             'requests.get',
             self.mockRequestsGetDeregisterInstancesFromLoadBalancer
     ):
         with mock.patch('nifcloud_lb.describe_load_balancers',
                         self.mockDescribeLoadBalancers):
             self.assertEqual(
                 (True, 'absent(lb001:80->80)'),
                 nifcloud_lb.deregist_instance(self.mockModule)
             )
Ejemplo n.º 2
0
 def test_deregist_instance_failed(self):
     with mock.patch(
             'requests.get',
             self.mockRequestsGetDeregisterInstancesFromLoadBalancer
     ):
         with mock.patch('nifcloud_lb.describe_load_balancers',
                         self.mockDescribeLoadBalancers):
             self.mockModule.params['instance_id'] = 'test999'
             self.assertEqual(
                 (False, 'absent()'),
                 nifcloud_lb.deregist_instance(self.mockModule)
             )
Ejemplo n.º 3
0
    def test_deregist_instance_check_mode(self):
        mockModule = mock.MagicMock(
            params=copy.deepcopy(self.mockModule.params),
            check_mode=True,
        )

        with mock.patch('nifcloud_lb.describe_load_balancers',
                        self.mockDescribeLoadBalancers):
            self.assertEqual(
                (True, 'present'),
                nifcloud_lb.deregist_instance(mockModule)
            )