Skip to content

Commit c573b13

Browse files
committed
Se añaden como variables de entorno los valores de correo y password
1 parent 21163d2 commit c573b13

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

test.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import unittest
2+
import os
23
import json
34
from Auth.Auth import Auth
45
from Stamp.Stamp import Stamp
@@ -20,100 +21,100 @@ def open_file(pathFile):
2021
out = open(pathFile, "r", encoding='ansi', errors='ignore').read()
2122
return out
2223
def testAuth(self):
23-
auth = Auth("http://services.test.sw.com.mx", None ,"userforut@ut.com", "swpassut")
24+
auth = Auth("http://services.test.sw.com.mx", None , os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
2425
response = auth.authentication()
2526
self.assertTrue(self.expected == response.get_status())
2627
def testStamp(self):
27-
stamp = Stamp("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
28+
stamp = Stamp("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
2829
response = stamp.stamp_v4(MyTest.open_file("resources\\xml40.xml"))
2930
if response.get_status() == "error":
3031
self.assertTrue(self.message == response.get_message())
3132
else:
3233
self.assertTrue(self.expected == response.get_status())
3334
def testIssue(self):
34-
issue = Issue("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
35+
issue = Issue("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
3536
response = issue.issue_v4(MyTest.open_file("resources\\xml40.xml"))
3637
if response.get_status() == "error":
3738
self.assertTrue(self.message == response.get_message())
3839
else:
3940
self.assertTrue(self.expected == response.get_status())
4041
def testIssueJson(self):
41-
issue = Issue("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
42+
issue = Issue("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
4243
response = issue.issue_json_v4(MyTest.open_file("resources\\cfdi.json"))
4344
if response.get_status() == "error":
4445
self.assertTrue(self.message == response.get_message())
4546
else:
4647
self.assertTrue(self.expected == response.get_status())
4748
def testBalance(self):
48-
balance = Balance("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
49+
balance = Balance("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
4950
response = balance.account_balance()
5051
self.assertTrue(self.expected == response.get_status())
5152

5253
def testCancelXml(self):
53-
cancel = Cancelation("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
54+
cancel = Cancelation("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
5455
response = cancel.CancelXml(MyTest.open_file("resources\\cancelByXml.xml"))
5556
self.assertTrue(self.expected == response.get_status())
5657

5758

5859
def testCancelCsd(self):
59-
cancel = Cancelation("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
60+
cancel = Cancelation("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
6061
response = cancel.CancelCsd("3dda215e-4c77-4923-94a1-627e0a04378c", "EKU9003173C9", MyTest.open_file("resources\\b64CSD.txt"), MyTest.open_file("resources\\b64Key.txt"),"12345678a", "02", "")
6162
self.assertTrue(self.expected == response.get_status())
6263

6364

6465
def testCancelPfx(self):
65-
cancel = Cancelation("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
66+
cancel = Cancelation("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
6667
response = cancel.CancelPfx("3dda215e-4c77-4923-94a1-627e0a04378c", "EKU9003173C9", MyTest.open_file("resources\\b64PFX.txt"), "12345678a", "02", "")
6768
self.assertTrue(self.expected == response.get_status())
6869

6970

7071
def testCancelUuid(self):
71-
cancel = Cancelation("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
72+
cancel = Cancelation("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
7273
response = cancel.CancelUuid("3dda215e-4c77-4923-94a1-627e0a04378c", "EKU9003173C9", "02", "")
7374
self.assertTrue(self.expected == response.get_status())
7475
def testValidateXml(self):
75-
validate = Validate("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
76+
validate = Validate("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
7677
response = validate.ValidateXml(MyTest.open_file("resources\\xml40.xml"))
7778
self.assertTrue(self.expected == response.get_status())
7879
def testRelationsCsd(self):
79-
relations = Relations("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
80+
relations = Relations("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
8081
response = relations.relations_csd("EKU9003173C9","316dff4d-6a5a-40d5-8558-c8f45244aa90",MyTest.open_file("resources\\b64CSD.txt"), MyTest.open_file("resources\\b64Key.txt"),"12345678a")
8182
self.assertTrue(self.expected == response.get_status())
8283
def testRelationsPfx(self):
83-
relations = Relations("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
84+
relations = Relations("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
8485
response = relations.relations_pfx("EKU9003173C9","316dff4d-6a5a-40d5-8558-c8f45244aa90",MyTest.open_file("resources\\b64PFX.txt"),"12345678a")
8586
self.assertTrue(self.expected == response.get_status())
8687
def testRelationsUuid(self):
87-
relations = Relations("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
88+
relations = Relations("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
8889
response = relations.relations_uuid("EKU9003173C9","316dff4d-6a5a-40d5-8558-c8f45244aa90")
8990
self.assertTrue(self.expected == response.get_status())
9091
def testPendings(self):
91-
pendings = Pendings("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
92+
pendings = Pendings("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
9293
response = pendings.pendings("EKU9003173C9")
9394
self.assertTrue(self.expected == response.get_status())
9495
def testStatusCfdi(self):
9596
objStatus = StatusCfdi.status("EKU9003173C9", "EKU9003173C9", "100.00", "316dff4d-6a5a-40d5-8558-c8f45244aa90", "https://pruebacfdiconsultaqr.cloudapp.net/ConsultaCFDIService.svc", "http://tempuri.org/IConsultaCFDIService/Consulta")
9697
self.assertTrue(objStatus.status_code == 200)
9798
def testAcceptRejectCsd(self):
98-
accept_reject = AcceptReject("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
99+
accept_reject = AcceptReject("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
99100
uuids = [{"uuid":"baf029f3-93ea-4267-a76c-1958d69bd4d8", "action":"Rechazo"}]
100101
response = accept_reject.accept_reject_csd("EKU9003173C9",uuids,MyTest.open_file("resources\\b64CSD.txt"), MyTest.open_file("resources\\b64Key.txt"),"12345678a")
101102
self.assertTrue(self.expected == response.get_status())
102103
def testAcceptRejectXml(self):
103-
accept_reject = AcceptReject("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
104+
accept_reject = AcceptReject("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
104105
response = accept_reject.accept_reject_xml(MyTest.open_file("resources\\fileAcceptReject.xml"))
105106
self.assertTrue(self.expected == response.get_status())
106107
def testAcceptRejectPfx(self):
107-
accept_reject = AcceptReject("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
108+
accept_reject = AcceptReject("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
108109
uuids = [{"uuid":"baf029f3-93ea-4267-a76c-1958d69bd4d8", "action":"Rechazo"}]
109110
response = accept_reject.accept_reject_pfx("EKU9003173C9",uuids,MyTest.open_file("resources\\b64PFX.txt"),"12345678a")
110111
self.assertTrue(self.expected == response.get_status())
111112
def testAcceptRejectUuid(self):
112-
accept_reject = AcceptReject("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
113+
accept_reject = AcceptReject("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
113114
response = accept_reject.accept_reject_uuid("EKU9003173C9","baf029f3-93ea-4267-a76c-1958d69bd4d8", "Rechazo")
114115
self.assertTrue(self.expected == response.get_status())
115116
def testUploadCsd(self):
116-
csd_obj = Csd("http://services.test.sw.com.mx", None, "userforut@ut.com", "swpassut")
117+
csd_obj = Csd("http://services.test.sw.com.mx", None, os.environ["USER_EMAIL"], os.environ["SW_PASSWORD"])
117118
response = csd_obj.upload_csd("stamp", MyTest.open_file("resources\\b64CSD.txt"), MyTest.open_file("resources\\b64Key.txt"),"12345678a")
118119
self.assertTrue(self.expected == response.get_status())
119120

0 commit comments

Comments
 (0)