From d71f7d7097f55500a5bdc9fe71ecd68a2a1aad1c Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Thu, 23 Feb 2017 13:57:57 +0000 Subject: [PATCH] Fix vCard unit tests --- .travis.yml | 2 +- gramps/plugins/importer/test/importvcard_test.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index fe71e1600..be066d7f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -90,7 +90,7 @@ before_script: - export PYTHONPATH=meta # set module exclusions. --exclude=TestUser because of older version of mock # without configure_mock - - export EXCLUDE="--exclude=TestcaseGenerator --exclude=vcard" + - export EXCLUDE="--exclude=TestcaseGenerator" # --exclude=merge_ref_test" # set GRAMPS_RESOURCES for locale, data,image and documentation - export GRAMPS_RESOURCES=. diff --git a/gramps/plugins/importer/test/importvcard_test.py b/gramps/plugins/importer/test/importvcard_test.py index b8107de46..364a0a851 100644 --- a/gramps/plugins/importer/test/importvcard_test.py +++ b/gramps/plugins/importer/test/importvcard_test.py @@ -72,7 +72,7 @@ class VCardCheck(unittest.TestCase): return ET.tostring(doc, encoding='utf-8') - def do_case(self, input_str, expect_doc, debug=True): + def do_case(self, input_str, expect_doc, debug=False): if debug: print(input_str) @@ -218,9 +218,10 @@ class VCardCheck(unittest.TestCase): self.do_case("\r\n".join(self.vcard), self.gramps) def test_check_version(self): - self.vcard.extend(["BEGIN:VCARD", "VERSION:3.7", "FN:Another", - "N:Another;;;;", "END:VCARD"]) - self.do_case("\r\n".join(self.vcard), self.gramps) + self.vcard = ["BEGIN:VCARD", "VERSION:3.7", "FN:Another", + "N:Another;;;;", "END:VCARD"] + expected = ET.XML(self.header + "") + self.do_case("\r\n".join(self.vcard), expected) def test_add_formatted_name_twice(self): self.vcard[2] = "FN:Lastname B A" @@ -252,7 +253,9 @@ class VCardCheck(unittest.TestCase): def test_add_name_multisurname(self): self.vcard[2] = "FN:Lastname Lastname2" self.vcard[3] = "N:Lastname,Lastname2;;;;" - ET.SubElement(self.name, 'surname').text = 'Lastname2' + surname = ET.SubElement(self.name, 'surname') + surname.text = 'Lastname2' + surname.set('prim', '0') self.do_case("\r\n".join(self.vcard), self.gramps) def test_add_name_prefixsurname(self):