コード例 #1
0
ファイル: test_utilities.py プロジェクト: SarvaPulla/tethys
    def test_get_wps_service_engine_with_app(self, mock_issubclass, mock_wps_obj, mock_activate_wps):
        from tethys_apps.base.app_base import TethysAppBase

        name = 'foo'

        mock_app_ws = mock.MagicMock()
        mock_app_ws.name = 'foo'

        mock_app_class = mock.MagicMock()
        mock_app_class().wps_services.return_value = [mock_app_ws]

        mock_issubclass.return_value = True

        mock_wps_obj.return_value = True

        ret = get_wps_service_engine(name=name, app_class=mock_app_class)

        self.assertTrue(ret)

        mock_issubclass.assert_called_once_with(mock_app_class, TethysAppBase)

        mock_wps_obj.assert_called_once_with(mock_app_ws.endpoint,
                                             username=mock_app_ws.username,
                                             password=mock_app_ws.password,
                                             verbose=False,
                                             skip_caps=True
                                             )

        mock_activate_wps.call_once_with(wps=True, endpoint=mock_app_ws.endpoint, name=mock_app_ws.name)
コード例 #2
0
ファイル: test_utilities.py プロジェクト: rileyhales/tethys
    def test_get_wps_service_engine_with_app(self, mock_issubclass, mock_wps_obj, mock_activate_wps):
        from tethys_apps.base.app_base import TethysAppBase

        name = 'foo'

        mock_app_ws = mock.MagicMock()
        mock_app_ws.name = 'foo'

        mock_app_class = mock.MagicMock()
        mock_app_class().wps_services.return_value = [mock_app_ws]

        mock_issubclass.return_value = True

        mock_wps_obj.return_value = True

        ret = get_wps_service_engine(name=name, app_class=mock_app_class)

        self.assertTrue(ret)

        mock_issubclass.assert_called_once_with(mock_app_class, TethysAppBase)

        mock_wps_obj.assert_called_once_with(mock_app_ws.endpoint,
                                             username=mock_app_ws.username,
                                             password=mock_app_ws.password,
                                             verbose=False,
                                             skip_caps=True
                                             )

        mock_activate_wps.call_once_with(wps=True, endpoint=mock_app_ws.endpoint, name=mock_app_ws.name)
コード例 #3
0
ファイル: test_utilities.py プロジェクト: SarvaPulla/tethys
    def test_get_wps_service_engine_with_site(self, mock_wps_model, mock_wps, mock_activate_wps):
        name = 'foo'
        mock_site_ws = mock.MagicMock()
        mock_site_ws.name = 'foo'

        mock_wps_model.objects.all.return_value = [mock_site_ws]

        mock_sdo = mock.MagicMock()
        mock_sdo.public_endpoint = mock_site_ws.public_endpoint

        mock_wps.return_value = mock_sdo

        get_wps_service_engine(name=name, app_class=None)

        mock_wps.assert_called_once_with(mock_site_ws.endpoint,
                                         username=mock_site_ws.username,
                                         password=mock_site_ws.password,
                                         verbose=False,
                                         skip_caps=True)

        mock_activate_wps.call_once_with(wps=mock_sdo, endpoint=mock_site_ws.endpoint, name=mock_site_ws.name)
コード例 #4
0
ファイル: test_utilities.py プロジェクト: rileyhales/tethys
    def test_get_wps_service_engine_with_site(self, mock_wps_model, mock_wps, mock_activate_wps):
        name = 'foo'
        mock_site_ws = mock.MagicMock()
        mock_site_ws.name = 'foo'

        mock_wps_model.objects.all.return_value = [mock_site_ws]

        mock_sdo = mock.MagicMock()
        mock_sdo.public_endpoint = mock_site_ws.public_endpoint

        mock_wps.return_value = mock_sdo

        get_wps_service_engine(name=name, app_class=None)

        mock_wps.assert_called_once_with(mock_site_ws.endpoint,
                                         username=mock_site_ws.username,
                                         password=mock_site_ws.password,
                                         verbose=False,
                                         skip_caps=True)

        mock_activate_wps.call_once_with(wps=mock_sdo, endpoint=mock_site_ws.endpoint, name=mock_site_ws.name)