Ejemplo n.º 1
0
 def test_info_plist_missing(self):
     """Info.plist missing"""
     delete_info_plist()
     try:
         with self.assertRaises(IOError):
             Workflow()
     finally:
         create_info_plist()
Ejemplo n.º 2
0
    def tearDown(self):
        create_info_plist()
        self.wf.reset()
        try:
            self.wf.delete_password(self.account)
        except PasswordNotFound:
            pass

        for dirpath in (self.wf.cachedir, self.wf.datadir):
            if os.path.exists(dirpath):
                shutil.rmtree(dirpath)

        self._teardown_env()
        delete_info_plist()
Ejemplo n.º 3
0
    def tearDown(self):
        create_info_plist()
        self.wf.reset()
        try:
            self.wf.delete_password(self.account)
        except PasswordNotFound:
            pass

        for dirpath in (self.wf.cachedir, self.wf.datadir):
            if os.path.exists(dirpath):
                shutil.rmtree(dirpath)

        self._teardown_env()
        delete_info_plist()
Ejemplo n.º 4
0
def ctx(args=None, update_settings=None, clear=True):
    update_settings = update_settings or UPDATE_SETTINGS
    args = args or []
    c = dummy()
    if args:
        # Add placeholder for ARGV[0]
        args = ['script'] + args
    create_info_plist()
    if args:
        c = WorkflowMock(args)
    with c:
        wf = Workflow(update_settings=update_settings)
        yield wf, c
    if clear:
        wf.reset()
        delete_info_plist()
Ejemplo n.º 5
0
def info3(request):
    """Ensure `info.plist` exists in the working directory."""
    create_info_plist(INFO_PLIST_TEST3)
    request.addfinalizer(delete_info_plist)
Ejemplo n.º 6
0
def info(request):
    """Ensure `info.plist` exists in the working directory."""
    create_info_plist()
    os.environ['alfred_version'] = '2.4'
    update._wf = None
    request.addfinalizer(delete_info_plist)
Ejemplo n.º 7
0
def info(request):
    """Ensure `info.plist` exists in the working directory."""
    create_info_plist()
    request.addfinalizer(delete_info_plist)
Ejemplo n.º 8
0
def info3(request):
    """Ensure `info.plist` exists in the working directory."""
    create_info_plist(INFO_PLIST_TEST3)
    os.environ['alfred_version'] = '3.0.2'
    update._wf = None
    request.addfinalizer(delete_info_plist)
def info3(request):
    """Ensure `info.plist` exists in the working directory."""
    create_info_plist(INFO_PLIST_TEST3)
    os.environ['alfred_version'] = '3.0.2'
    update._wf = None
    request.addfinalizer(delete_info_plist)
Ejemplo n.º 10
0
 def setUp(self):
     create_info_plist()
Ejemplo n.º 11
0
    def setUp(self):
        self.libs = [os.path.join(os.path.dirname(__file__), b'lib')]
        self.account = 'this-is-my-test-account'
        self.password = '******'
        self.password2 = 'this-is-my-other-safe-password'
        self.password3 = 'this-pässwörd-is\\"non-ASCII"'
        self.search_items = [
            ('Test Item One', MATCH_STARTSWITH),
            ('test item two', MATCH_STARTSWITH),
            ('TwoExtraSpecialTests', MATCH_CAPITALS),
            ('this-is-a-test', MATCH_ATOM),
            ('the extra special trials', MATCH_INITIALS_STARTSWITH),
            ('not the extra special trials', MATCH_INITIALS_CONTAIN),
            ('intestinal fortitude', MATCH_SUBSTRING),
            ('the splits', MATCH_ALLCHARS),
            ('nomatch', 0),
        ]

        self.search_items_diacritics = [
            # search key, query
            ('Änderungen vorbehalten', 'av'),
            ('Änderungen', 'anderungen'),
            ('überwiegend bewolkt', 'ub'),
            ('überwiegend', 'uberwiegend'),
            ('Öffnungszeiten an Feiertagen', 'offnungszeiten'),
            ('Öffnungszeiten an Feiertagen', 'oaf'),
            ('Fußpilz', 'fuss'),
            ('salé', 'sale')
        ]

        self.punctuation_data = [
            ('"test"', '"test"'),
            ('„wat denn?“', '"wat denn?"'),
            ('‚wie dat denn?‘', "'wie dat denn?'"),
            ('“test”', '"test"'),
            ('and—why—not', 'and-why-not'),
            ('10–20', '10-20'),
            ('Shady’s back', "Shady's back"),
        ]

        self.env_data = {
            'alfred_debug': b'1',
            'alfred_preferences':
            os.path.expanduser(b'~/Dropbox/Alfred/Alfred.alfredpreferences'),
            'alfred_preferences_localhash':
            b'adbd4f66bc3ae8493832af61a41ee609b20d8705',
            'alfred_theme': b'alfred.theme.yosemite',
            'alfred_theme_background': b'rgba(255,255,255,0.98)',
            'alfred_theme_subtext': b'3',
            'alfred_version': b'2.4',
            'alfred_version_build': b'277',
            'alfred_workflow_bundleid': str(BUNDLE_ID),
            'alfred_workflow_cache':
            os.path.expanduser(b'~/Library/Caches/com.runningwithcrayons.'
                               b'Alfred-2/Workflow Data/{0}'.format(BUNDLE_ID)),
            'alfred_workflow_data':
            os.path.expanduser(b'~/Library/Application Support/Alfred 2/'
                               b'Workflow Data/{0}'.format(BUNDLE_ID)),
            'alfred_workflow_name': b'Alfred-Workflow Test',
            'alfred_workflow_uid':
            b'user.workflow.B0AC54EC-601C-479A-9428-01F9FD732959',
        }

        self._setup_env()
        create_info_plist()

        self.wf = Workflow(libraries=self.libs)
Ejemplo n.º 12
0
    def setUp(self):
        self.libs = [os.path.join(os.path.dirname(__file__), b'lib')]
        self.account = 'this-is-my-test-account'
        self.password = '******'
        self.password2 = 'this-is-my-other-safe-password'
        self.password3 = 'this-pässwörd-is\\"non-ASCII"'
        self.search_items = [
            ('Test Item One', MATCH_STARTSWITH),
            ('test item two', MATCH_STARTSWITH),
            ('TwoExtraSpecialTests', MATCH_CAPITALS),
            ('this-is-a-test', MATCH_ATOM),
            ('the extra special trials', MATCH_INITIALS_STARTSWITH),
            ('not the extra special trials', MATCH_INITIALS_CONTAIN),
            ('intestinal fortitude', MATCH_SUBSTRING),
            ('the splits', MATCH_ALLCHARS),
            ('nomatch', 0),
        ]

        self.search_items_diacritics = [
            # search key, query
            ('Änderungen vorbehalten', 'av'),
            ('Änderungen', 'anderungen'),
            ('überwiegend bewolkt', 'ub'),
            ('überwiegend', 'uberwiegend'),
            ('Öffnungszeiten an Feiertagen', 'offnungszeiten'),
            ('Öffnungszeiten an Feiertagen', 'oaf'),
            ('Fußpilz', 'fuss'),
            ('salé', 'sale')
        ]

        self.punctuation_data = [
            ('"test"', '"test"'),
            ('„wat denn?“', '"wat denn?"'),
            ('‚wie dat denn?‘', "'wie dat denn?'"),
            ('“test”', '"test"'),
            ('and—why—not', 'and-why-not'),
            ('10–20', '10-20'),
            ('Shady’s back', "Shady's back"),
        ]

        self.env_data = {
            'alfred_debug': b'1',
            'alfred_preferences':
            os.path.expanduser(b'~/Dropbox/Alfred/Alfred.alfredpreferences'),
            'alfred_preferences_localhash':
            b'adbd4f66bc3ae8493832af61a41ee609b20d8705',
            'alfred_theme': b'alfred.theme.yosemite',
            'alfred_theme_background': b'rgba(255,255,255,0.98)',
            'alfred_theme_subtext': b'3',
            'alfred_version': b'2.4',
            'alfred_version_build': b'277',
            'alfred_workflow_bundleid': str(BUNDLE_ID),
            'alfred_workflow_cache':
            os.path.expanduser(b'~/Library/Caches/com.runningwithcrayons.'
                               b'Alfred-2/Workflow Data/{0}'.format(BUNDLE_ID)),
            'alfred_workflow_data':
            os.path.expanduser(b'~/Library/Application Support/Alfred 2/'
                               b'Workflow Data/{0}'.format(BUNDLE_ID)),
            'alfred_workflow_name': b'Alfred-Workflow Test',
            'alfred_workflow_uid':
            b'user.workflow.B0AC54EC-601C-479A-9428-01F9FD732959',
        }

        self._setup_env()
        create_info_plist()

        self.wf = Workflow(libraries=self.libs)
Ejemplo n.º 13
0
 def setUp(self):
     create_info_plist()
     self.wf = Workflow()
Ejemplo n.º 14
0
def info(request):
    """Ensure `info.plist` exists in the working directory."""
    create_info_plist()
    os.environ['alfred_version'] = '2.4'
    update._wf = None
    request.addfinalizer(delete_info_plist)
def info3(request):
    """Ensure `info.plist` exists in the working directory."""
    create_info_plist(INFO_PLIST_TEST3)
    request.addfinalizer(delete_info_plist)
Ejemplo n.º 16
0
def info(request):
    """Ensure `info.plist` exists in the working directory."""
    create_info_plist()
    request.addfinalizer(delete_info_plist)
 def setUp(self):
     create_info_plist()
     self.wf = Workflow()