コード例 #1
0
ファイル: test_pocket.py プロジェクト: rockkoca/alfred-pocket
    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)
コード例 #2
0
ファイル: test_pocket.py プロジェクト: kumters/alfred-pocket
    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)
コード例 #3
0
ファイル: test_pocket.py プロジェクト: rockkoca/alfred-pocket
    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)
コード例 #4
0
ファイル: test_pocket.py プロジェクト: rockkoca/alfred-pocket
    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)
コード例 #5
0
    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))
コード例 #6
0
ファイル: test_pocket.py プロジェクト: rockkoca/alfred-pocket
    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)
コード例 #7
0
ファイル: test_pocket.py プロジェクト: kumters/alfred-pocket
    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)
コード例 #8
0
ファイル: test_pocket.py プロジェクト: kumters/alfred-pocket
    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)
コード例 #9
0
    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))
コード例 #10
0
ファイル: test_pocket.py プロジェクト: rockkoca/alfred-pocket
    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)
コード例 #11
0
ファイル: test_pocket.py プロジェクト: rockkoca/alfred-pocket
    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)
コード例 #12
0
ファイル: test_pocket.py プロジェクト: kumters/alfred-pocket
    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)
コード例 #13
0
    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)
コード例 #14
0
    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)