Esempio n. 1
0
def test_wsdl_retriever_wsdl(mock_taverna_parser, mock_webservice_parser,
                             mock_link_test):
    """
    Unable to find any valid Taverna URLs? Raise ValueError
    """
    with pytest.raises(ValueError):
        wsdl_retriever()
Esempio n. 2
0
    def __init__(self, link=None):
        """
        The constructor; establishes the webservice link for the client

        Initializes the client with a weblink

        Parameters
        ----------
        link : str
            Contains URL to valid WSDL endpoint

        Examples
        --------
        >>> from sunpy.net.helio import hec
        >>> hc = hec.HECClient()  # doctest: +REMOTE_DATA

        """
        if link is None:
            # The default wsdl file
            link = parser.wsdl_retriever()

        self.votable_interceptor = VotableInterceptor()
        self.hec_client = C(link,
                            plugins=[self.votable_interceptor],
                            transport=WellBehavedHttpTransport())
Esempio n. 3
0
    def __init__(self, link=None):
        """
        The constructor; establishes the webservice link for the client

        Initializes the client with a weblink

        Parameters
        ----------
        link : str
            Contains URL to valid WSDL endpoint

        Examples
        --------
        >>> from sunpy.net.helio import hec
        >>> hc = hec.HECClient()  # doctest: +REMOTE_DATA

        """
        if link is None:
            # The default wsdl file
            link = parser.wsdl_retriever()
        # Disable SSL check.
        session = Session()
        session.verify = False
        transport = Transport(session=session)
        self.hec_client = Client(link, transport=transport)
Esempio n. 4
0
    def __init__(self, link=None):
        """
        The constructor; establishes the webservice link for the client

        Initializes the client with a weblink

        Parameters
        ----------
        link: str
            Contains URL to valid WSDL endpoint

        Examples
        --------
        >>> hc = hec.HECClient()
        """
        if link is None:
            # The default wsdl file
            link = parser.wsdl_retriever()

        self.votable_interceptor = VotableInterceptor()
        self.hec_client = C(link, plugins=[self.votable_interceptor], transport=WellBehavedHttpTransport())
Esempio n. 5
0
    def __init__(self, link=None):
        """
        The constructor; establishes the webservice link for the client

        Initializes the client with a weblink

        Parameters
        ----------
        link : str
            Contains URL to valid WSDL endpoint

        Examples
        --------
        >>> from sunpy.net.helio import hec
        >>> hc = hec.HECClient()  # doctest: +REMOTE_DATA

        """
        if link is None:
            # The default wsdl file
            link = parser.wsdl_retriever()

        self.hec_client = zeep.Client(link)
Esempio n. 6
0
File: hec.py Progetto: Cadair/sunpy
    def __init__(self, link=None):
        """
        The constructor; establishes the webservice link for the client

        Initializes the client with a weblink

        Parameters
        ----------
        link : str
            Contains URL to valid WSDL endpoint

        Examples
        --------
        >>> from sunpy.net.helio import hec
        >>> hc = hec.HECClient()  # doctest: +REMOTE_DATA

        """
        if link is None:
            # The default wsdl file
            link = parser.wsdl_retriever()

        self.hec_client = zeep.Client(link)
Esempio n. 7
0
    def __init__(self, link=None):
        """
        The constructor; establishes the webservice link for the client

        Initializes the client with a weblink

        Parameters
        ----------
        link : str
            Contains URL to valid WSDL endpoint

        Examples
        --------
        >>> from sunpy.net.helio import hec
        >>> hc = hec.HECClient()  # doctest: +REMOTE_DATA
        """
        if link is None:
            # The default wsdl file
            link = parser.wsdl_retriever()
        session = Session()
        # This is for use in our test suite.
        session.verify = not (bool(os.environ.get("NO_VERIFY_HELIO_SSL", 0)))
        transport = Transport(session=session)
        self.hec_client = Client(link, transport=transport)
Esempio n. 8
0
def test_wsdl_retriever_get_link(mock_link_test, mock_taverna_parser, mock_webservice_parser):
    """
    Get a Taverna link
    """
    assert wsdl_retriever() == 'http://www.helio.uk/Taverna/hec?wsdl'
Esempio n. 9
0
Access the Helio Event Catalogue
"""
from sunpy.net.proxyfix import WellBehavedHttpTransport
from sunpy.net.helio import parser
from sunpy.time import time as T
from suds.client import Client as C
from astropy.io.votable.table import parse_single_table
import io

__author__ = "Michael Malocha"
__version__ = "September 22nd, 2013"

__all__ = ["HECClient"]

# The default wsdl file
DEFAULT_LINK = parser.wsdl_retriever()


def suds_unwrapper(wrapped_data):
    """
    Removes suds wrapping from returned xml data

    When grabbing data via client.last_received() from the suds.client.Client
    module, it returns the xml data in an un-helpful "<s:Envelope>" that needs
    to be removed. This function politely cleans it up.

    Parameters
    ----------
    wrapped_data: str
        Contains the wrapped xml results from a WSDL query
Esempio n. 10
0
def test_wsdl_retriever_get_link(mock_link_test, mock_taverna_parser,
                                 mock_webservice_parser):
    """
    Get a Taverna link
    """
    assert wsdl_retriever() == 'http://www.helio.uk/Taverna/hec?wsdl'
Esempio n. 11
0
def test_wsdl_retriever_no_content(mock_endpoint_parser):
    """
    No links found? Raise ValueError
    """
    with pytest.raises(ValueError):
        wsdl_retriever()
Esempio n. 12
0
def test_wsdl_retriever_no_content(mock_endpoint_parser):
    """
    No links found? Return None
    """
    assert wsdl_retriever() is None
Esempio n. 13
0
def test_wsdl_retriever_wsdl(mock_taverna_parser, mock_webservice_parser, mock_link_test):
    """
    Unable to find any valid Taverna URLs? Raise ValueError
    """
    with pytest.raises(ValueError):
        wsdl_retriever()
Esempio n. 14
0
def test_wsdl_retriever_no_content(mock_endpoint_parser):
    """
    No links found? Raise ValueError
    """
    with pytest.raises(ValueError):
        wsdl_retriever()
Esempio n. 15
0
def test_wsdl_retriever_no_taverna_urls(mock_taverna_parser,
                                        mock_webservice_parser):
    """
    Unable to find any valid Taverna URLs? Return None
    """
    assert wsdl_retriever() is None
Esempio n. 16
0
def test_wsdl_retriever_no_content(mock_endpoint_parser):
    """
    No links found? Return None
    """
    assert wsdl_retriever() is None
Esempio n. 17
0
def test_wsdl_retriever_no_taverna_urls(mock_taverna_parser, mock_webservice_parser):
    """
    Unable to find any valid Taverna URLs? Return None
    """
    assert wsdl_retriever() is None