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)
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)
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)
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)
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)
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)
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)
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()