Changeset 15593


Ignore:
Timestamp:
19 Sep 2019, 10:12:53 (5 years ago)
Author:
Henrik Bettermann
Message:

Update tests.

Location:
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/browser_templates/requery_etranzact.pt

    r15589 r15593  
    1212          Transaction Id:</td>
    1313        <td>
    14           <span tal:replace="view/context/p_id">TRANSID</span>
     14          <span tal:replace="view/transaction_id">TRANSID</span>
    1515        </td>
    1616      </tr>
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/helpers.py

    r15589 r15593  
    5454        return 'Connection error (%s, %s)' % (response.status, response.reason)
    5555    resp = response.read()
    56     resp = resp.replace('\r\n','')
    57     # eTranzact sends strange HTML tags which must be removed.
    58     resp = re.sub("<.*?>", "", resp)
    5956    return resp
    6057
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/etranzact/tests.py

    r15589 r15593  
    115115        response = query_history(HOST, self.terminal_id,
    116116                                transaction_id, HTTPS, 'http://xxxxx')
    117         self.assertEqual(
    118             response,
     117        self.assertTrue(
    119118            'Transaction with the given transaction_id (%s) not found'
    120             % transaction_id)
     119            % transaction_id in response)
    121120        # Okay, let's create a transaction
    122121        caller_response = create_transaction(transaction_id)
     
    126125        query_response = query_history(HOST, self.terminal_id,
    127126                                transaction_id, HTTPS, 'http://xxxxx')
    128         self.assertEqual(query_response, '')
     127        self.assertTrue(
     128            '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\r\n    '
     129            '"http://www.w3.org/TR/html4/loose.dtd">' in query_response)
    129130        # The same, an 'empty' response obviously means that the transaction
    130         # was found. The result was  sent to the response_url (see below).
    131         # We need browser tests.
     131        # was found but no result was  sent to the response_url because the
     132        # payment was cancelled.
     133
     134        # Peter: No response would be returned because payment status information
     135        # was not saved. Whenever you get a null response, means payment was
     136        # not received only payments with error code 0 is successful.
     137        # So in this case transaction fails.
     138
     139        # Peter has manually created a successful payment. Let's use this one.
     140        transaction_id = 'etz1568638104web'
     141        query_response = query_history(HOST, self.terminal_id,
     142                                transaction_id, HTTPS, 'http://xxxxx')
     143        # Now eTranzact is redirecting but the response is still useless
     144        print query_response
     145        self.assertTrue('Redirecting...' in query_response)
    132146        return
    133147
     
    163177        self.browser.getLink("Pay via eTranzact").click()
    164178        self.assertTrue("Pay now" in self.browser.contents)
    165         # Means of testing end here. We have to manually
    166179        # create an eTranzact transaction.
    167180        logo_url = 'http://xxxx'
     
    178191                   customer.display_fullname, hashvalue,
    179192                   logo_url)
     193        self.browser.open(self.payment_url + '/requery_history')
     194        # Means of testing end here.
     195
     196        #hashargs =     amount + TERMINAL_ID + 'etz1568638104web' \
     197        #    + responseurl + 'DEMO_KEY'
     198        #hashvalue = hashlib.md5(hashargs).hexdigest()
     199        #self.browser.open(self.payment_url + '/requery_history')
     200        #self.browser.getControl("Requery now").click()
     201        #import pdb; pdb.set_trace()
     202
     203
    180204        return
    181205
Note: See TracChangeset for help on using the changeset viewer.