示例#1
0
文件: api.py 项目: danlopez00/usgs
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
示例#2
0
文件: api.py 项目: jonas-eberle/usgs
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
示例#3
0
    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)
示例#4
0
 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)