|
1 | 1 | import unittest |
2 | 2 | import os |
3 | | -import json |
4 | 3 | import sys |
5 | 4 |
|
| 5 | +#Función para poder importar módulos necesarios. |
6 | 6 | PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)) |
7 | 7 | sys.path.append(PROJECT_ROOT) |
8 | 8 |
|
|
11 | 11 | class TestBalance(unittest.TestCase): |
12 | 12 | expected = "success" |
13 | 13 |
|
14 | | - def testBalance_Auth(self): |
15 | | - balance = Balance("http://services.test.sw.com.mx", None, os.environ["SDKTEST_USER"], os.environ["SDKTEST_PASSWORD"]) |
16 | | - response = balance.account_balance() |
| 14 | + def testBalance_auth(self): |
| 15 | + balance = Balance("https://services.test.sw.com.mx","https://api.test.sw.com.mx", None, os.environ['SDKTEST_USER'], os.environ['SDKTEST_PASSWORD']) |
| 16 | + response = balance.get_balance() |
17 | 17 | self.assertTrue(self.expected == response.get_status()) |
18 | 18 | self.assertIsNotNone(response.get_data()) |
| 19 | + self.assertIsNotNone(response.data.idUser) |
| 20 | + self.assertIsNotNone(response.data.idUserBalance) |
| 21 | + self.assertIsNotNone(response.data.stampsAssigned) |
| 22 | + self.assertIsNotNone(response.data.stampsUsed) |
| 23 | + self.assertIsNotNone(response.data.stampsBalance) |
19 | 24 |
|
20 | 25 | def testBalance(self): |
21 | | - balance = Balance("http://services.test.sw.com.mx", os.environ["SDKTEST_TOKEN"]) |
22 | | - response = balance.account_balance() |
| 26 | + balance = Balance("https://services.test.sw.com.mx","https://api.test.sw.com.mx", os.environ["SDKTEST_TOKEN"]) |
| 27 | + response = balance.get_balance() |
23 | 28 | self.assertTrue(self.expected == response.get_status()) |
24 | 29 | self.assertIsNotNone(response.get_data()) |
| 30 | + self.assertIsNotNone(response.data.idUser) |
| 31 | + self.assertIsNotNone(response.data.idUserBalance) |
| 32 | + self.assertIsNotNone(response.data.stampsAssigned) |
| 33 | + self.assertIsNotNone(response.data.stampsUsed) |
| 34 | + self.assertIsNotNone(response.data.stampsBalance) |
| 35 | + |
| 36 | + @unittest.skip("Evitar conflictos por temas de saldos") |
| 37 | + def testBalance_add_auth(self): |
| 38 | + balance = Balance("https://services.test.sw.com.mx","https://api.test.sw.com.mx",None, os.environ["SDKTEST_USER"], os.environ["SDKTEST_PASSWORD"]) |
| 39 | + response = balance.add_stamps("32501CF2-DC62-4370-B47D-25024C44E131",1,"Prueba Pyhton") |
| 40 | + self.assertTrue(self.expected == response.get_status()) |
| 41 | + self.assertIsNotNone(response.get_data()) |
| 42 | + print(response.get_data()) |
| 43 | + |
| 44 | + @unittest.skip("Evitar conflictos por temas de saldos") |
| 45 | + def testBalance_add(self): |
| 46 | + balance = Balance("https://services.test.sw.com.mx","https://api.test.sw.com.mx", os.environ["SDKTEST_TOKEN"]) |
| 47 | + response = balance.add_stamps("32501CF2-DC62-4370-B47D-25024C44E131",1,"Prueba Pyhton") |
| 48 | + self.assertTrue(self.expected == response.get_status()) |
| 49 | + self.assertIsNotNone(response.get_data()) |
| 50 | + print(response.get_data()) |
| 51 | + |
| 52 | + @unittest.skip("Evitar conflictos por temas de saldos") |
| 53 | + def testBalance_remove_auth(self): |
| 54 | + balance = Balance("https://services.test.sw.com.mx","https://api.test.sw.com.mx",None, os.environ["SDKTEST_USER"], os.environ["SDKTEST_PASSWORD"]) |
| 55 | + response = balance.remove_stamps("32501CF2-DC62-4370-B47D-25024C44E131",1,"Prueba Pyhton") |
| 56 | + self.assertTrue(self.expected == response.get_status()) |
| 57 | + self.assertIsNotNone(response.get_data()) |
| 58 | + print(response.get_data()) |
| 59 | + |
| 60 | + @unittest.skip("Evitar conflictos por temas de saldos") |
| 61 | + def testBalance_remove(self): |
| 62 | + balance = Balance("https://services.test.sw.com.mx","https://api.test.sw.com.mx", os.environ["SDKTEST_TOKEN"]) |
| 63 | + response = balance.remove_stamps("32501CF2-DC62-4370-B47D-25024C44E131",1,"Prueba Pyhton") |
| 64 | + self.assertTrue(self.expected == response.get_status()) |
| 65 | + self.assertIsNotNone(response.get_data()) |
| 66 | + print(response.get_data()) |
25 | 67 |
|
26 | 68 | suite = unittest.TestLoader().loadTestsFromTestCase(TestBalance) |
27 | 69 | unittest.TextTestRunner(verbosity=2).run(suite) |
0 commit comments