def test_retry(self): with HTTMock(error_mock): with self.assertRaises(SystemExit) as cm: iloveck101(self.thread_url) self.assertEqual(cm.exception.code, 'Oops, can not fetch the page')
def test_list(self): with HTTMock(list_mock, image_mock): iloveck101(self.list_url) with HTTMock(error_mock): iloveck101(self.list_url)
def test_not_ck101(self): with self.assertRaises(SystemExit) as cm: iloveck101('http://google.com/') self.assertEqual(cm.exception.code, 'This is not ck101 url')
def test_thread(self): with HTTMock(thread_mock, image_mock): iloveck101(self.thread_url)