Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion messages/src/vonage_messages/models/rcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class BaseRcs(BaseMessage):
"""

to: PhoneNumber
from_: str = Field(..., serialization_alias='from', pattern='^[a-zA-Z0-9-_]+$')
from_: str = Field(..., serialization_alias='from', pattern='^[a-zA-Z0-9-_&]+$')
ttl: Optional[int] = Field(None, ge=300, le=259200)
channel: ChannelType = ChannelType.RCS

Expand Down
21 changes: 21 additions & 0 deletions messages/tests/test_rcs_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,27 @@ def test_create_rcs_text():
assert rcs_model.model_dump(by_alias=True, exclude_none=True) == rcs_dict


def test_create_rcs_text_with_ampersand():
"""Tests that RCS from fields will allow an ampersand (&) character.

See also: DEVX-10155
"""
rcs_model = RcsText(
to='1234567890',
from_='Acme&SonsCo',
text='Hello, World!',
)
rcs_dict = {
'to': '1234567890',
'from': 'Acme&SonsCo',
'text': 'Hello, World!',
'channel': 'rcs',
'message_type': 'text',
}

assert rcs_model.model_dump(by_alias=True, exclude_none=True) == rcs_dict


def test_create_rcs_text_all_fields():
rcs_model = RcsText(
to='1234567890',
Expand Down