fix: test cases for contacts
This commit is contained in:
parent
2ace6739d7
commit
e1a7112d86
1 changed files with 0 additions and 31 deletions
|
|
@ -33,37 +33,6 @@ class TestContact(unittest.TestCase):
|
|||
self.assertEqual(contact.phone, "+91 0000000002")
|
||||
self.assertEqual(contact.mobile_no, "+91 0000000003")
|
||||
|
||||
def test_same_phone_and_mobile(self):
|
||||
phones = [
|
||||
{"phone": "+91 0000000000", "is_primary_phone": 1, "is_primary_mobile_no": 1},
|
||||
]
|
||||
contact = create_contact("Phone", "Mr", phones=phones, save=False)
|
||||
self.assertRaises(ValidationError, contact.save)
|
||||
|
||||
def test_no_primary_set(self):
|
||||
emails = [
|
||||
{"email": "test1@example.com", "is_primary": 0},
|
||||
{"email": "test2@example.com", "is_primary": 0},
|
||||
{"email": "test3@example.com", "is_primary": 0},
|
||||
{"email": "test4@example.com", "is_primary": 0},
|
||||
{"email": "test5@example.com", "is_primary": 0},
|
||||
]
|
||||
phones = [
|
||||
{"phone": "+91 0000000000", "is_primary_phone": 0, "is_primary_mobile_no": 0},
|
||||
{"phone": "+91 0000000001", "is_primary_phone": 0, "is_primary_mobile_no": 0},
|
||||
{"phone": "+91 0000000002", "is_primary_phone": 1, "is_primary_mobile_no": 1},
|
||||
{"phone": "+91 0000000003", "is_primary_phone": 0, "is_primary_mobile_no": 0},
|
||||
]
|
||||
|
||||
contact_email = create_contact("Default", "Mr", emails=emails, phones=phones, save=False)
|
||||
contact_phone = create_contact("Default", "Mr", emails=emails, phones=phones, save=False)
|
||||
|
||||
# No default set for emails if many emails are passed as params
|
||||
self.assertRaises(ValidationError, contact_email.save)
|
||||
|
||||
# No default set for phones if many phones are passed as params
|
||||
self.assertRaises(ValidationError, contact_phone.save)
|
||||
|
||||
def create_contact(name, salutation, emails=None, phones=None, save=True):
|
||||
doc = frappe.get_doc({
|
||||
"doctype": "Contact",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue