def test_main_error(self): CachedData['__workflow_update_status'] = {'available': True} CachedData['pocket_error'] = 'AuthException' sys.argv = ['pocket.py', ''] def send_feedback(): pass pocket.WF.send_feedback = send_feedback pocket.main(None)
def test_main_error(self): CachedData['__workflow_update_status'] = { 'available': True } CachedData['pocket_error'] = 'AuthException' sys.argv = ['pocket.py', ''] def send_feedback(): pass pocket.WF.send_feedback = send_feedback pocket.main(None)
def test_main_mylist(self): CachedData['__workflow_update_status'] = {'available': False} CachedData['pocket_list'] = test_data.get_normal() sys.argv = ['pocket.py', 'in:mylist '] def send_feedback(): pass pocket.WF.send_feedback = send_feedback pocket.WF._items = [] pocket.main(None) self.assertEquals(len(pocket.WF._items), 3)
def test_main_empty(self): CachedData['__workflow_update_status'] = {'available': False} sys.argv = ['pocket.py', 'in:mylist '] def send_feedback(): pass pocket.WF.send_feedback = send_feedback pocket.WF._items = [] pocket.main(None) self.assertEquals(len(pocket.WF._items), 1) self.assertTrue('Pocket list is empty' in pocket.WF._items[0].title)
def test_main_initial(self): pocket.WF._version.major = 'x' # make sure that WF.first_run is True CachedData['__workflow_update_status'] = {'available': True} sys.argv = ['pocket.py', ''] def send_feedback(): pass pocket.WF.send_feedback = send_feedback pocket.WF._items = [] pocket.main(None) self.assertEquals(len(pocket.WF._items), 1 + len(pocket.CATEGORIES))
def test_main_videos(self): CachedData['__workflow_update_status'] = {'available': False} CachedData['pocket_list'] = test_data.get_normal() sys.argv = ['pocket.py', 'in:videos '] def send_feedback(): pass pocket.WF.send_feedback = send_feedback pocket.WF._items = [] pocket.main(None) self.assertTrue(len(pocket.WF._items), 1) self.assertTrue('archive.com' in pocket.WF._items[0].subtitle)
def test_main_mylist(self): CachedData['__workflow_update_status'] = { 'available': False } CachedData['pocket_list'] = test_data.get_normal() sys.argv = ['pocket.py', 'in:mylist '] def send_feedback(): pass pocket.WF.send_feedback = send_feedback pocket.WF._items = [] pocket.main(None) self.assertEquals(len(pocket.WF._items), 3)
def test_main_empty(self): CachedData['__workflow_update_status'] = { 'available': False } sys.argv = ['pocket.py', 'in:mylist '] def send_feedback(): pass pocket.WF.send_feedback = send_feedback pocket.WF._items = [] pocket.main(None) self.assertEquals(len(pocket.WF._items), 1) self.assertTrue('Pocket list is empty' in pocket.WF._items[0].title)
def test_main_initial(self): pocket.WF._version.major = 'x' # make sure that WF.first_run is True CachedData['__workflow_update_status'] = { 'available': True } sys.argv = ['pocket.py', ''] def send_feedback(): pass pocket.WF.send_feedback = send_feedback pocket.WF._items = [] pocket.main(None) self.assertEquals(len(pocket.WF._items), 1 + len(pocket.CATEGORIES))
def test_main_single_tag(self): CachedData['__workflow_update_status'] = {'available': False} CachedData['pocket_list'] = test_data.get_normal() CachedData['pocket_tags'] = ['mytag'] sys.argv = ['pocket.py', 'in:mytags #mytag'] def send_feedback(): pass pocket.WF.send_feedback = send_feedback pocket.WF._items = [] pocket.main(None) self.assertEquals(len(pocket.WF._items), 1) self.assertTrue('google.com' in pocket.WF._items[0].subtitle)
def test_main_mytags_search(self): CachedData['__workflow_update_status'] = {'available': False} CachedData['pocket_list'] = test_data.get_normal() CachedData['pocket_tags'] = ['interesting', 'tag2', 'tag3', 'tag4'] sys.argv = ['pocket.py', 'in:mytags interes'] def send_feedback(): pass pocket.WF.send_feedback = send_feedback pocket.WF._items = [] pocket.main(None) self.assertEquals(len(pocket.WF._items), 1) self.assertTrue('interesting' in pocket.WF._items[0].title)
def test_main_articles(self): CachedData['__workflow_update_status'] = { 'available': False } CachedData['pocket_list'] = test_data.get_normal() sys.argv = ['pocket.py', 'in:articles '] def send_feedback(): pass pocket.WF.send_feedback = send_feedback pocket.WF._items = [] pocket.main(None) self.assertTrue(len(pocket.WF._items), 1) self.assertTrue('google.com' in pocket.WF._items[0].subtitle)
def test_main_mytags_search(self): CachedData['__workflow_update_status'] = { 'available': False } CachedData['pocket_list'] = test_data.get_normal() CachedData['pocket_tags'] = ['interesting', 'tag2', 'tag3', 'tag4'] sys.argv = ['pocket.py', 'in:mytags interes'] def send_feedback(): pass pocket.WF.send_feedback = send_feedback pocket.WF._items = [] pocket.main(None) self.assertEquals(len(pocket.WF._items), 1) self.assertTrue('interesting' in pocket.WF._items[0].title)
del importErr import keyring as keyring try: if 'piaplib.lint' not in sys.modules: from . import lint as lint else: # pragma: no branch lint = sys.modules["""piaplib.lint"""] except Exception as importErr: del importErr import lint as lint if __name__ in u'__main__': try: if 'piaplib.pocket' not in sys.modules: from . import pocket as pocket else: # pragma: no branch pocket = sys.modules["""piaplib.pocket"""] except Exception: import pocket as pocket if pku.__name__ is None: raise ImportError(str(u'Failed to open Pocket Knife Unit')) if keyring.__name__ is None: raise ImportError(str(u'Failed to find Pocket Keyring')) if lint.__name__ is None: raise ImportError(str(u'Failed to gather Pocket Lint')) if book.__name__ is None: raise ImportError(str(u'Failed to open Pocket Book')) pocket.main(sys.argv[1:]) exit(0)