Ejemplo n.º 1
0
 def client(self):
     client = OFXClient(
         "https://example.com/ofx",
         userid="elmerfudd",
         org="FIORG",
         fid="FID",
         version=103,
         bankid="123456789",
         brokerid="example.com",
         persist_cookies=
         False,  # TESTME - need to test `persist_cookies`=True
     )
     # Mock out OFXClient._get_service_urls(), which hits the Internet.
     client._get_service_urls = Mock(
         return_value={StmtRq: "https://example.com/ofx"})
     return client
Ejemplo n.º 2
0
    def testRequestStatementsUnclosedTags(self):
        client = OFXClient(
            "https://example.com/ofx",
            userid="elmerfudd",
            org="FIORG",
            fid="FID",
            version=103,
            close_elements=False,
            bankid="123456789",
            brokerid="example.com",
            persist_cookies=False,
        )
        # Mock out OFXClient._get_service_urls(), which hits the Internet.
        client._get_service_urls = Mock(
            return_value={StmtRq: "https://example.com/ofx"})
        data = self._testRequest(client.request_statements, "t0ps3kr1t",
                                 self.stmtRq0)

        request = ("OFXHEADER:100\r\n"
                   "DATA:OFXSGML\r\n"
                   "VERSION:103\r\n"
                   "SECURITY:NONE\r\n"
                   "ENCODING:USASCII\r\n"
                   "CHARSET:NONE\r\n"
                   "COMPRESSION:NONE\r\n"
                   "OLDFILEUID:NONE\r\n"
                   "NEWFILEUID:DEADBEEF\r\n"
                   "\r\n"
                   "<OFX>"
                   "<SIGNONMSGSRQV1>"
                   "<SONRQ>"
                   "<DTCLIENT>20170401000000.000[0:GMT]"
                   "<USERID>elmerfudd"
                   "<USERPASS>t0ps3kr1t"
                   "<LANGUAGE>ENG"
                   "<FI>"
                   "<ORG>FIORG"
                   "<FID>FID"
                   "</FI>"
                   "<APPID>{appid}"
                   "<APPVER>{appver}"
                   "</SONRQ>"
                   "</SIGNONMSGSRQV1>"
                   "<BANKMSGSRQV1>"
                   "<STMTTRNRQ>"
                   "<TRNUID>DEADBEEF"
                   "<STMTRQ>"
                   "<BANKACCTFROM>"
                   "<BANKID>123456789"
                   "<ACCTID>111111"
                   "<ACCTTYPE>CHECKING"
                   "</BANKACCTFROM>"
                   "<INCTRAN>"
                   "<DTSTART>20170101000000.000[0:GMT]"
                   "<DTEND>20170331000000.000[0:GMT]"
                   "<INCLUDE>Y"
                   "</INCTRAN>"
                   "</STMTRQ>"
                   "</STMTTRNRQ>"
                   "</BANKMSGSRQV1>"
                   "</OFX>").format(appid=DEFAULT_APPID, appver=DEFAULT_APPVER)

        self.assertEqual(data, request)