Skip to content

Commit

Permalink
chore: label is directly settable
Browse files Browse the repository at this point in the history
  • Loading branch information
ecederstrand committed Apr 23, 2024
1 parent 661b809 commit 6330c4c
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,31 +245,28 @@ def random_val(self, field):
if isinstance(field, EmailAddressesField):
addrs = []
for label in EmailAddress.get_field_by_fieldname("label").supported_choices(version=self.account.version):
addr = EmailAddress(email=get_random_email())
addr.label = label
addrs.append(addr)
addrs.append(EmailAddress(email=get_random_email(), label=label))
return addrs
if isinstance(field, PhysicalAddressField):
addrs = []
for label in PhysicalAddress.get_field_by_fieldname("label").supported_choices(
version=self.account.version
):
addr = PhysicalAddress(
street=get_random_string(32),
city=get_random_string(32),
state=get_random_string(32),
country=get_random_string(32),
zipcode=get_random_string(8),
addrs.append(
PhysicalAddress(
street=get_random_string(32),
city=get_random_string(32),
state=get_random_string(32),
country=get_random_string(32),
zipcode=get_random_string(8),
label=label,
)
)
addr.label = label
addrs.append(addr)
return addrs
if isinstance(field, PhoneNumberField):
pns = []
for label in PhoneNumber.get_field_by_fieldname("label").supported_choices(version=self.account.version):
pn = PhoneNumber(phone_number=get_random_string(16))
pn.label = label
pns.append(pn)
pns.append(PhoneNumber(phone_number=get_random_string(16), label=label))
return pns
if isinstance(field, EWSElementField):
if field.value_cls == Recurrence:
Expand Down

0 comments on commit 6330c4c

Please sign in to comment.