コード例 #1
0
def test_get_applications_locale(mock_getlocale, tmpdir):
    mock_getlocale.return_value = 'es_AR.UTF-8'

    application_dir = tmpdir.mkdir('applications')

    # create some fake applications
    test_app_1 = application_dir.join('test-app-1.app')
    test_app_1.write(json.dumps(TEST_APP))

    test_app_1_es = application_dir.join('locale', 'es_AR', 'test-app-1.app')
    test_app_1_es.write(json.dumps(TEST_APP_ES), ensure=True)

    with patch(
        'kano_apps.AppData._SYSTEM_APPLICATIONS_LOC',
        os.path.join(application_dir.strpath, '')
    ):
        apps = get_applications()

    assert len(apps) == 1

    test_app = apps[0]
    assert test_app['title'] == 'Pruebas'
    assert test_app['launch_command'] == {
        'cmd': 'echo',
        'args': [u'¡Hola!'],
    }
コード例 #2
0
def test_get_applications_blacklist(tmpdir):
    application_dir = tmpdir.mkdir('applications')

    # create some fake applications
    test_app_1 = application_dir.join('test-app-1.app')
    test_app_1.write(json.dumps(TEST_APP))

    blacklisted_app = application_dir.join('blacklisted.app')
    blacklisted_app.write(json.dumps(TEST_APP))

    with patch('kano_apps.AppData._SYSTEM_APPLICATIONS_LOC',
               os.path.join(application_dir.strpath, '')):
        apps = get_applications()

    assert len(apps) == 1

    test_app = apps[0]
    assert test_app['title'] == 'Test App'
コード例 #3
0
def test_get_applications(tmpdir):
    application_dir = tmpdir.mkdir('applications')

    # create some fake applications
    test_app_1 = application_dir.join('test-app-1.app')
    test_app_1.write(json.dumps(TEST_APP))

    with patch('kano_apps.AppData._SYSTEM_APPLICATIONS_LOC',
               os.path.join(application_dir.strpath, '')):
        apps = get_applications()

    assert len(apps) == 1

    test_app = apps[0]
    assert test_app['title'] == 'Test App'
    assert test_app['launch_command'] == {
        'cmd': 'echo',
        'args': ['Hi'],
    }
コード例 #4
0
def test_get_applications_blacklist(tmpdir):
    application_dir = tmpdir.mkdir('applications')

    # create some fake applications
    test_app_1 = application_dir.join('test-app-1.app')
    test_app_1.write(json.dumps(TEST_APP))

    blacklisted_app = application_dir.join('blacklisted.app')
    blacklisted_app.write(json.dumps(TEST_APP))

    with patch(
        'kano_apps.AppData._SYSTEM_APPLICATIONS_LOC',
        os.path.join(application_dir.strpath, '')
    ):
        apps = get_applications()

    assert len(apps) == 1

    test_app = apps[0]
    assert test_app['title'] == 'Test App'
コード例 #5
0
def test_get_applications(tmpdir):
    application_dir = tmpdir.mkdir('applications')

    # create some fake applications
    test_app_1 = application_dir.join('test-app-1.app')
    test_app_1.write(json.dumps(TEST_APP))

    with patch(
        'kano_apps.AppData._SYSTEM_APPLICATIONS_LOC',
        os.path.join(application_dir.strpath, '')
    ):
        apps = get_applications()

    assert len(apps) == 1

    test_app = apps[0]
    assert test_app['title'] == 'Test App'
    assert test_app['launch_command'] == {
        'cmd': 'echo',
        'args': ['Hi'],
    }
コード例 #6
0
def test_get_applications_locale(mock_getlocale, tmpdir):
    mock_getlocale.return_value = 'es_AR.UTF-8'

    application_dir = tmpdir.mkdir('applications')

    # create some fake applications
    test_app_1 = application_dir.join('test-app-1.app')
    test_app_1.write(json.dumps(TEST_APP))

    test_app_1_es = application_dir.join('locale', 'es_AR', 'test-app-1.app')
    test_app_1_es.write(json.dumps(TEST_APP_ES), ensure=True)

    with patch('kano_apps.AppData._SYSTEM_APPLICATIONS_LOC',
               os.path.join(application_dir.strpath, '')):
        apps = get_applications()

    assert len(apps) == 1

    test_app = apps[0]
    assert test_app['title'] == 'Pruebas'
    assert test_app['launch_command'] == {
        'cmd': 'echo',
        'args': [u'¡Hola!'],
    }
コード例 #7
0
 def refresh(self, category=None):
     for app in get_applications():
         if self._apps.has_app(app):
             self._apps.update_app(app)
         else:
             self._apps.add_app(app)
コード例 #8
0
 def show_apps_view(self, button=None, event=None):
     self._top_bar.disable_prev()
     self._apps = apps = Apps(get_applications(), self)
     self.get_main_area().set_contents(apps)
コード例 #9
0
 def refresh(self, category=None):
     for app in get_applications():
         if self._apps.has_app(app):
             self._apps.update_app(app)
         else:
             self._apps.add_app(app)
コード例 #10
0
 def show_apps_view(self, button=None, event=None):
     self._top_bar.disable_prev()
     self._apps = apps = Apps(get_applications(), self)
     self.get_main_area().set_contents(apps)