Skip to content

Commit

Permalink
[FIX] l10n_mx_res_partner_csf: expand test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
SMaciasOSI committed Oct 11, 2023
1 parent 9bf196d commit e04808c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions l10n_mx_res_partner_csf/tests/test_contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,10 @@ def setUp(self):
}
)

def test_import_csf(self):
action = self.partner.action_upload_csf()
def test_import_csf_pdf_file(self):
generated_file = os.path.join("l10n_mx_res_partner_csf", "tests", "demo.pdf")
generated_file = tools.misc.file_open(generated_file, "rb")
data = base64.encodebytes(generated_file.read())
record_csf = (
self.env[action.get("res_model")]
.with_context(active_id=self.partner.id)
.create({"file": data, "file_name": "demo.txt"})
)
with self.assertRaises(UserError):
record_csf.upload_csf()

record1 = self.import_obj.with_context(active_id=self.partner.id).create(
{"file": data, "file_name": "demo.pdf"}
Expand All @@ -45,3 +37,13 @@ def test_import_csf(self):
self.assertEqual(" JURICA", self.partner.street2)
self.assertEqual("QUERETARO", self.partner.city)
self.assertEqual(self.country_id.id, self.partner.country_id.id)

def test_import_csf_txt_file(self):
action = self.partner.action_upload_csf()
record_csf = (
self.env[action.get("res_model")]
.with_context(active_id=self.partner.id)
.create({"file": "fake_data", "file_name": "demo.txt"})
)
with self.assertRaises(UserError):
record_csf.upload_csf()

0 comments on commit e04808c

Please sign in to comment.