Exemplo n.º 1
0
 def test_poll_error(self):
     api = MagicMock()
     with patch('apsconnectcli.apsconnect.poll_deployment') as poll_deployment_mock, \
             patch('apsconnectcli.apsconnect.sys') as sys_mock:
         poll_deployment_mock.return_value = AvailabilityCheckResult(False, 'Error')
         _create_deployment('name', 'image', api)
         self.assertTrue(poll_deployment_mock.called)
         sys_mock.exit.assert_called_with(1)
    def _perform_check(self, mock_get_del_opts, is_force, fake_core_v1,
                       fake_ext_v1, assert_ext_v1_fn, assert_core_v1_fn):
        mock_get_del_opts.return_value = self._FAKE_DEL_OPTS

        dummy_str = '1q2w3e4r5t!Q@W#E$R%T^Y'
        replicas_count = 2
        test_image = _to_bytes(dummy_str)
        test_body = self._create_test_body(self._TEST_NAME, replicas_count,
                                           test_image, '/')

        _create_deployment(name=self._TEST_NAME,
                           image=test_image,
                           api=fake_ext_v1,
                           core_api=fake_core_v1,
                           force=is_force)

        assert_ext_v1_fn(fake_ext_v1, test_body)
        assert_core_v1_fn(fake_core_v1)