def content_count(self): return len(( # we always want to call SMSMessageTemplate.__str__ regardless of subclass, to avoid any html formatting SMSMessageTemplate.__str__(self) if self._values else sms_encode( add_prefix(self.content.strip(), self.prefix))).encode( self.encoding))
def test_sms_encode(mocker): sanitise_mock = mocker.patch('notifications_utils.formatters.SanitiseSMS') assert sms_encode('foo') == sanitise_mock.encode.return_value sanitise_mock.encode.assert_called_once_with('foo')
def __str__(self): return sms_encode(self._get_unsanitised_content())
def test_sms_encode(): assert sms_encode('aàá…') == 'aàa...'