コード例 #1
0
    def test_name(self):
        # Arrange
        mailbox = Mailbox(phone_number='+15555555555', carrier='Foo Wireless')

        # Act
        reply = _process_answer('Jane Foo', mailbox)

        # Assert
        self.assertEqual(mailbox.name, 'Jane Foo')
        self.assertIn('your email address', reply)
コード例 #2
0
    def test_call_forwarding_reminder(self):
        # Arrange
        mailbox = Mailbox(
            phone_number='+15555555555',
            carrier='Verizon Wireless',
            name='Jane Foo',
            email='*****@*****.**')

        # Act
        reply = _process_answer('halp', mailbox)

        # Assert
        self.assertIn('still waiting to receive my first voicemail', reply)
コード例 #3
0
    def test_invalid_email(self):
        # Arrange
        mailbox = Mailbox(
            phone_number='+15555555555',
            carrier='Verizon Wireless',
            name='Jane Foo')

        # Act
        reply = _process_answer('jane@foo', mailbox)

        # Assert
        self.assertIsNone(mailbox.email)
        self.assertIn('Maybe it has a typo', reply)
コード例 #4
0
    def test_email(self):
        # Arrange
        mailbox = Mailbox(
            phone_number='+15555555555',
            carrier='Verizon Wireless',
            name='Jane Foo')

        # Act
        reply = _process_answer('*****@*****.**', mailbox)

        # Assert
        self.assertEqual(mailbox.email, '*****@*****.**')
        self.assertIn('forward your missed calls', reply)
コード例 #5
0
    def test_no_idea(self):
        # Arrange
        mailbox = Mailbox(
            phone_number='+15555555555',
            carrier='Verizon Wireless',
            name='Jane Foo',
            email='*****@*****.**',
            call_forwarding_set=True,
            feelings_on_qr_codes='love')

        # Act
        reply = _process_answer("I'm the user and I feel lonely!", mailbox)

        # Assert
        self.assertIn('Looking for help?', reply)
コード例 #6
0
    def test_qr_codes_unsure(self):
        # Arrange
        mailbox = Mailbox(
            phone_number='+15555555555',
            carrier='Verizon Wireless',
            name='Jane Foo',
            email='*****@*****.**',
            call_forwarding_set=True)
        mailbox.send_config_image = MagicMock()

        # Act
        reply = _process_answer("I can take them or leave them", mailbox)

        # Assert
        self.assertIsNone(mailbox.feelings_on_qr_codes)
        self.assertIn('kidder', reply)

        self.assertFalse(mailbox.send_config_image.called)
コード例 #7
0
    def test_qr_codes_no(self):
        # Arrange
        mailbox = Mailbox(
            phone_number='+15555555555',
            carrier='Verizon Wireless',
            name='Jane Foo',
            email='*****@*****.**',
            call_forwarding_set=True)
        mailbox.send_config_image = MagicMock()

        # Act
        reply = _process_answer('not so much', mailbox)

        # Assert
        self.assertEqual(mailbox.feelings_on_qr_codes, 'hate')
        self.assertIn('for nerds', reply)

        self.assertFalse(mailbox.send_config_image.called)
コード例 #8
0
    def test_qr_codes_yes(self):
        # Arrange
        mailbox = Mailbox(
            phone_number='+15555555555',
            carrier='Verizon Wireless',
            name='Jane Foo',
            email='*****@*****.**',
            call_forwarding_set=True)
        mailbox.send_config_image = MagicMock()

        # Act
        reply = _process_answer('YEAH', mailbox)

        # Assert
        self.assertEqual(mailbox.feelings_on_qr_codes, 'love')
        self.assertIn('ME TOO', reply)

        mailbox.send_config_image.assert_called_once_with()