|
4 | 4 |
|
5 | 5 |
|
6 | 6 | class TestPayments(unittest.TestCase): |
7 | | - adyen = Adyen.Adyen() |
8 | | - |
9 | | - client = adyen.client |
10 | | - test = BaseTest(adyen) |
11 | | - client.username = "YourWSUser" |
12 | | - client.password = "YourWSPassword" |
13 | | - client.platform = "test" |
14 | | - client.app_name = "appname" |
15 | 7 |
|
16 | 8 | def test_authorise_success_mocked(self): |
17 | 9 | request = {} |
@@ -197,14 +189,40 @@ def test_error_401_mocked(self): |
197 | 189 | self.adyen.payment.authorise, request) |
198 | 190 |
|
199 | 191 |
|
200 | | -TestPayments.client.http_force = "requests" |
201 | | -suite = unittest.TestLoader().loadTestsFromTestCase(TestPayments) |
202 | | -unittest.TextTestRunner(verbosity=2).run(suite) |
203 | | -TestPayments.client.http_force = "pycurl" |
204 | | -TestPayments.client.http_init = False |
205 | | -suite = unittest.TestLoader().loadTestsFromTestCase(TestPayments) |
206 | | -unittest.TextTestRunner(verbosity=2).run(suite) |
207 | | -TestPayments.client.http_force = "other" |
208 | | -TestPayments.client.http_init = False |
209 | | -suite = unittest.TestLoader().loadTestsFromTestCase(TestPayments) |
210 | | -unittest.TextTestRunner(verbosity=2).run(suite) |
| 192 | +class BasicAuth(TestPayments): |
| 193 | + adyen = Adyen.Adyen() |
| 194 | + |
| 195 | + client = adyen.client |
| 196 | + test = BaseTest(adyen) |
| 197 | + client.username = "YourWSUser" |
| 198 | + client.password = "YourWSPassword" |
| 199 | + client.platform = "test" |
| 200 | + client.app_name = "appname" |
| 201 | + |
| 202 | + |
| 203 | +class XApiKey(TestPayments): |
| 204 | + adyen = Adyen.Adyen() |
| 205 | + |
| 206 | + client = adyen.client |
| 207 | + test = BaseTest(adyen) |
| 208 | + client.platform = "test" |
| 209 | + client.app_name = "appname" |
| 210 | + client.xapikey = "YourWSXApiKey" |
| 211 | + |
| 212 | + |
| 213 | +def test_with(auth): |
| 214 | + auth.client.http_force = "requests" |
| 215 | + suite = unittest.TestLoader().loadTestsFromTestCase(auth) |
| 216 | + unittest.TextTestRunner(verbosity=2).run(suite) |
| 217 | + auth.client.http_force = "pycurl" |
| 218 | + auth.client.http_init = False |
| 219 | + suite = unittest.TestLoader().loadTestsFromTestCase(auth) |
| 220 | + unittest.TextTestRunner(verbosity=2).run(suite) |
| 221 | + auth.client.http_force = "other" |
| 222 | + auth.client.http_init = False |
| 223 | + suite = unittest.TestLoader().loadTestsFromTestCase(auth) |
| 224 | + unittest.TextTestRunner(verbosity=2).run(suite) |
| 225 | + |
| 226 | + |
| 227 | +test_with(BasicAuth) |
| 228 | +test_with(XApiKey) |
0 commit comments