예제 #1
0
    def test_has_invalid_email_addresses_BasicMessage_ReturnsListOfOne_WhenToHasOneInvalid(self):
        # Arrange
        message = BasicMessage()
        message.to_email_address = [EmailAddress(self.random_helper.random_string())]
        
        # Act        
        actual = has_invalid_email_addresses(message)

        # Assert
        self.assertEqual(1, len(actual))
예제 #2
0
    def test_get_full_recipient_count_BasicMessage_ReturnsGT0_WhenOnlyToRecipientsHasOneValue(self):
        # Arrange
        message = BasicMessage()
        message.to_email_address = self.random_helper.random_list_of_email_addresses(1)

        # Act
        actual = get_full_recipient_count(message)

        # Assert
        self.assertTrue(actual > 0)
예제 #3
0
    def test_validate_email_addresses_BasicMessage_ReturnsSuccess_WhenToIsNotEmpty(self):
        #  Arrange
        message = BasicMessage()
        message.to_email_address = [self.random_helper.random_email_address()]

        #  Act
        actual = validate_email_addresses(message)

        #  Assert
        self.assertEqual(SendResult.Success, actual.result)
예제 #4
0
    def test_validate_email_addresses_BasicMessage_ReturnsTooManyRecipients_WhenToHasToManyRecipients(self):
        #  Arrange
        num_in_list = int(maximumRecipientsPerMessage + 1)
        message = BasicMessage()
        message.to_email_address = self.random_helper.random_list_of_email_addresses(num_in_list)

        #  Act
        actual = validate_email_addresses(message)

        #  Assert
        self.assertEqual(SendResult.RecipientValidationMaxExceeded, actual.result)
예제 #5
0
    def test_has_invalid_email_addresses_BasicMessage_ReturnsNull_WhenNoInvalidRecipientsFound(self):
        # Arrange
        message = BasicMessage()
        message.to_email_address = self.random_helper.random_list_of_email_addresses(1)
        message.cc_email_address = self.random_helper.random_list_of_email_addresses(1)
        message.bcc_email_address = self.random_helper.random_list_of_email_addresses(1)

        # Act
        actual = has_invalid_email_addresses(message)

        # Assert
        self.assertIsNone(actual)