Fix vCard unit tests
This commit is contained in:
parent
06476cfc6d
commit
d71f7d7097
@ -90,7 +90,7 @@ before_script:
|
|||||||
- export PYTHONPATH=meta
|
- export PYTHONPATH=meta
|
||||||
# set module exclusions. --exclude=TestUser because of older version of mock
|
# set module exclusions. --exclude=TestUser because of older version of mock
|
||||||
# without configure_mock
|
# without configure_mock
|
||||||
- export EXCLUDE="--exclude=TestcaseGenerator --exclude=vcard"
|
- export EXCLUDE="--exclude=TestcaseGenerator"
|
||||||
# --exclude=merge_ref_test"
|
# --exclude=merge_ref_test"
|
||||||
# set GRAMPS_RESOURCES for locale, data,image and documentation
|
# set GRAMPS_RESOURCES for locale, data,image and documentation
|
||||||
- export GRAMPS_RESOURCES=.
|
- export GRAMPS_RESOURCES=.
|
||||||
|
@ -72,7 +72,7 @@ class VCardCheck(unittest.TestCase):
|
|||||||
|
|
||||||
return ET.tostring(doc, encoding='utf-8')
|
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:
|
if debug:
|
||||||
print(input_str)
|
print(input_str)
|
||||||
|
|
||||||
@ -218,9 +218,10 @@ class VCardCheck(unittest.TestCase):
|
|||||||
self.do_case("\r\n".join(self.vcard), self.gramps)
|
self.do_case("\r\n".join(self.vcard), self.gramps)
|
||||||
|
|
||||||
def test_check_version(self):
|
def test_check_version(self):
|
||||||
self.vcard.extend(["BEGIN:VCARD", "VERSION:3.7", "FN:Another",
|
self.vcard = ["BEGIN:VCARD", "VERSION:3.7", "FN:Another",
|
||||||
"N:Another;;;;", "END:VCARD"])
|
"N:Another;;;;", "END:VCARD"]
|
||||||
self.do_case("\r\n".join(self.vcard), self.gramps)
|
expected = ET.XML(self.header + "</database>")
|
||||||
|
self.do_case("\r\n".join(self.vcard), expected)
|
||||||
|
|
||||||
def test_add_formatted_name_twice(self):
|
def test_add_formatted_name_twice(self):
|
||||||
self.vcard[2] = "FN:Lastname B A"
|
self.vcard[2] = "FN:Lastname B A"
|
||||||
@ -252,7 +253,9 @@ class VCardCheck(unittest.TestCase):
|
|||||||
def test_add_name_multisurname(self):
|
def test_add_name_multisurname(self):
|
||||||
self.vcard[2] = "FN:Lastname Lastname2"
|
self.vcard[2] = "FN:Lastname Lastname2"
|
||||||
self.vcard[3] = "N: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)
|
self.do_case("\r\n".join(self.vcard), self.gramps)
|
||||||
|
|
||||||
def test_add_name_prefixsurname(self):
|
def test_add_name_prefixsurname(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user