Exemplo n.º 1
0
    def test_error_raise_on_status_code_404(self):
        with patch('requests.get') as mock_request:
            mock_request.return_value = \
                RequestMock(status_code=404, file_name='test/html/detail_text.txt')

            l = Letter(email='pete', msg_id=5994491)

            with self.assertRaises(MailinatorException):
                l.fetch()
Exemplo n.º 2
0
    def test_error_raise_on_status_code_404(self):
        with patch('requests.get') as mock_request:
            mock_request.return_value = \
                RequestMock(status_code=404, file_name='test/html/detail_text.txt')

            l = Letter(email='pete', msg_id=5994491)

            with self.assertRaises(MailinatorException):
                l.fetch()
Exemplo n.º 3
0
    def test_basic_fetch(self):
        with patch('requests.get') as mock_request:
            mock_request.return_value = \
                RequestMock(status_code=200, file_name='test/html/detail_text.txt')

            l = Letter(email='pete', msg_id=5994491)
            l.fetch()

            self.assertTrue("Have A Big Curry!" in l.subject)
            self.assertTrue("Jackie Arroyo" in l.from_address)
            self.assertTrue("Healthcare Online" in l.message_html)
Exemplo n.º 4
0
    def test_basic_fetch(self):
        with patch('requests.get') as mock_request:
            mock_request.return_value = \
                RequestMock(status_code=200, file_name='test/html/detail_text.txt')

            l = Letter(email='pete', msg_id=5994491)
            l.fetch()

            self.assertTrue("Have A Big Curry!" in l.subject)
            self.assertTrue("Jackie Arroyo" in l.from_address)
            self.assertTrue("Healthcare Online" in l.message_html)