예제 #1
0
 def test_weird_uidls3(self):
     '''A longer list (wrong)'''
     uidl = ['OK', ['1 weird', '1 msg', 'uid 3'], 42]
     mock = MagicMock()
     mock.return_value = False
     with patch('pop3_maildir.already_downloaded', mock):
         with assert_raises(UidError):
             what_to_download(uidl, None)
예제 #2
0
 def test_new_msgs(self):
     '''DB says all new'''
     uidl = ['OK', ['1 a', '2 b', '3 c'], 42]
     mock = MagicMock()
     mock.return_value = False
     with patch('pop3_maildir.already_downloaded', mock):
         out = what_to_download(uidl, None)
     assert out == [1, 2, 3]
예제 #3
0
 def test_already_downl(self):
     '''DB returns all downloaded'''
     uidl = ['OK', ['1 a', '2 b', '3 c'], 42]
     mock = MagicMock()
     mock.return_value = True
     with patch('pop3_maildir.already_downloaded', mock):
         out = what_to_download(uidl, None)
     assert out == []
예제 #4
0
 def test_weird_uidls2(self):
     '''msg number + uid has no space in between'''
     uidl = ['OK', ['1weird'], 42]
     with assert_raises(UidError):
         what_to_download(uidl, None)
예제 #5
0
 def test_weird_uidls(self):
     '''msg number is not a number'''
     uidl = ['OK', ['a weird'], 42]
     with assert_raises(UidError):
         what_to_download(uidl, None)
예제 #6
0
 def test_errlist(self):
     '''F*ckd up list'''
     uidl = ['yadda yadda yadda']
     with assert_raises(UidError):
         what_to_download(uidl, None)