Ejemplo n.º 1
0
 def test_fetch_organisation_xml(self):
     """
     We can fetch an organisation type XML file
     """
     url = "https://aidstream.org/files/xml/ask-org.xml"
     req = requesters.IatiXMLRequest(url=url)
     async_to_sync(req.get)(refresh=False, internal_session=True)
     async_to_sync(req.organisations)()
Ejemplo n.º 2
0
 def test_activities_xml(self):
     """
     We can fetch an activities type XML file
     """
     url = "https://aidstream.org/files/xml/ask-activities.xml"
     requester = requesters.IatiXMLRequest(url=url)
     async_to_sync(requester.get)(refresh=False, internal_session=True)
     async_to_sync(requester.activities)()
Ejemplo n.º 3
0
    def test_save_one_activity(self):
        import json

        url = "https://aidstream.org/files/xml/ask-activities.xml"
        requester = requesters.IatiXMLRequest(url=url)
        async_to_sync(requester.get)(refresh=False, internal_session=True)
        activities = async_to_sync(requester.activities)()
        json.dumps(activities[0])
        async_to_sync(requester.to_instances)()
Ejemplo n.º 4
0
    async def test_multiple_get_one_session(self):
        url_list = {
            "ask_activities":
            requesters.IatiXMLRequest(
                url="https://aidstream.org/files/xml/ask-activities.xml"),
            "ask_org":
            requesters.IatiXMLRequest(
                url="https://aidstream.org/files/xml/ask-org.xml"),
            "organisation_ask":
            requesters.BaseRequest(
                url=
                "https://iatiregistry.org/api/3/action/package_search?fq=organization:ask"  # noqa
            ),
            "organisation_list":
            requesters.BaseRequest(
                url="https://iatiregistry.org/api/3/action/organization_list"),
        }

        for i in url_list.values():
            i.drop_sync()

        async with ClientSession(connector=TCPConnector(ssl=False)) as session:
            coros = [i.get(session=session) for i in url_list.values()]
            await asyncio.gather(*coros)
Ejemplo n.º 5
0
 def test_animals_can_speak(self):
     """Animals that can speak are correctly identified"""
     pass
     url = "https://aidstream.org/files/xml/ask-activities.xml"
     requesters.IatiXMLRequest(url=url)