コード例 #1
0
#!/usr/bin/python

from gi.repository import Gtk
import time
import unittest

from testutils import setup_test_env

setup_test_env()

# overwrite early
import softwarecenter.utils

from softwarecenter.enums import TransactionTypes
from softwarecenter.utils import convert_desktop_file_to_installed_location
from softwarecenter.db.application import Application
from softwarecenter.ui.gtk3.panes.availablepane import get_test_window
from softwarecenter.backend.unitylauncher import UnityLauncherInfo

# Tests for Ubuntu Software Center's integration with the Unity launcher,
# see https://wiki.ubuntu.com/SoftwareCenter#Learning%20how%20to%20launch%20an%20application

# we can only have one instance of availablepane, so create it here
win = get_test_window()
available_pane = win.get_data("pane")


class TestUnityLauncherIntegration(unittest.TestCase):
    def setUp(self):
        # monkey patch is_unity_running
        softwarecenter.utils.is_unity_running = lambda: True
コード例 #2
0
#!/usr/bin/python

import apt_pkg
import apt
import logging
import json
import unittest
import xapian

from mock import patch
from piston_mini_client import PistonResponseObject
from testutils import setup_test_env
setup_test_env()

from softwarecenter.enums import (
    XapianValues,
    AVAILABLE_FOR_PURCHASE_MAGIC_CHANNEL_NAME,
    PURCHASED_NEEDS_REINSTALL_MAGIC_CHANNEL_NAME,
)
from softwarecenter.db.database import StoreDatabase
from softwarecenter.db.update import (
    add_from_purchased_but_needs_reinstall_data,
    SCAPurchasedApplicationParser,
    SCAApplicationParser,
)

# Example taken from running:
# PYTHONPATH=. utils/piston-helpers/piston_generic_helper.py --output=pickle \
#           --debug --needs-auth SoftwareCenterAgentAPI subscriptions_for_me
# then:
#    f = open('my_subscriptions.pickle')