1 | ## $Id: tests.py 7929 2012-03-20 15:21:01Z henrik $ |
---|
2 | ## |
---|
3 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
4 | ## This program is free software; you can redistribute it and/or modify |
---|
5 | ## it under the terms of the GNU General Public License as published by |
---|
6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
7 | ## (at your option) any later version. |
---|
8 | ## |
---|
9 | ## This program is distributed in the hope that it will be useful, |
---|
10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | ## GNU General Public License for more details. |
---|
13 | ## |
---|
14 | ## You should have received a copy of the GNU General Public License |
---|
15 | ## along with this program; if not, write to the Free Software |
---|
16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
17 | ## |
---|
18 | from hurry.workflow.interfaces import IWorkflowState |
---|
19 | from waeup.kofa.students.tests.test_browser import StudentsFullSetup |
---|
20 | from waeup.custom.testing import FunctionalLayer |
---|
21 | |
---|
22 | class EtranzactTests(StudentsFullSetup): |
---|
23 | """Tests foreTranzact payment gateway. |
---|
24 | """ |
---|
25 | |
---|
26 | layer = FunctionalLayer |
---|
27 | |
---|
28 | CONFIRMATION_NO = '500856521315472785095' |
---|
29 | |
---|
30 | def test_etranzact_query_history(self): |
---|
31 | |
---|
32 | # Managers can add online payment tickets |
---|
33 | self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
34 | self.browser.open(self.payments_student_path) |
---|
35 | IWorkflowState(self.student).setState('cleared') |
---|
36 | self.browser.open(self.payments_student_path + '/addop') |
---|
37 | self.browser.getControl("Create ticket").click() |
---|
38 | self.assertMatches('...ticket created...', |
---|
39 | self.browser.contents) |
---|
40 | ctrl = self.browser.getControl(name='val_id') |
---|
41 | value = ctrl.options[0] |
---|
42 | self.browser.getLink(value).click() |
---|
43 | self.assertMatches('...Amount Authorized...', |
---|
44 | self.browser.contents) |
---|
45 | payment_url = self.browser.url |
---|
46 | |
---|
47 | self.browser.open(payment_url + '/query_history?confirmation_number=%s' |
---|
48 | % self.CONFIRMATION_NO) |
---|
49 | self.assertMatches('...Wrong amount...', |
---|
50 | self.browser.contents) |
---|
51 | |
---|
52 | self.student['payments'][value].amount_auth = self.student[ |
---|
53 | 'payments'][value].r_amount_approved |
---|
54 | self.browser.open(payment_url + '/query_history?confirmation_number=%s' |
---|
55 | % self.CONFIRMATION_NO) |
---|
56 | self.assertMatches('...Wrong transaction id...', |
---|
57 | self.browser.contents) |
---|