Exemple #1
0
    def test_index(self):
        """Testing method / function index."""
        # Initialize key variables
        expected = 'The Pattoo Agent API is Operational.\n'

        # Create URL
        config = Config()
        agent_url = config.agent_api_server_url('')
        url = agent_url.replace('/receive/', '/status')

        # Check response
        with requests.get(url) as response:
            result = response.text
        self.assertEqual(expected, result)
Exemple #2
0
    def __init__(self, identifier, data):
        """Initialize the class.

        Args:
            identifier: Unique identifier for the source of the data. (AgentID)
            data: dict of data to post

        Returns:
            None

        """
        # Initialize key variables
        config = Config()

        # Get posting URL
        self._data = data
        self._identifier = identifier
        self._url = config.agent_api_server_url(identifier)