def logout(): api_key = _get_api_key() xml = soap.logout(api_key=api_key) requests.post(USGS_API, xml) if os.path.exists(TMPFILE): os.remove(TMPFILE) return True
def test_logout(self): expected = """ <soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://earthexplorer.usgs.gov/inventory/soap"> <soapenv:Header/> <soapenv:Body> <soap:logout soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <apiKey xsi:type="xsd:string">USERS API KEY</apiKey> </soap:logout> </soapenv:Body> </soapenv:Envelope> """ request = soap.logout(api_key="USERS API KEY") request = minidom.parseString(request).toprettyxml() assert compare_xml(request, expected)