Exemplo n.º 1
0
def test_original_init():
    config = TConfig()
    updater = PyiUpdater(config)
    client = Client(updater, test=True)
    assert client.app_name == u'jms'
    assert client.update_urls[0] == (u'https://s3-us-west-1.amazon'
                                     'aws.com/pyi-test/')
Exemplo n.º 2
0
    def __init__(self):
        self.file_crypt = FileCrypt()
        self.config = self.load_config()
        self.pyi_updater = PyiUpdater(self.config)
        self.key_handler = KeyHandler()
        self.package_handler = PackageHandler()
        self.uploader = Uploader()
        self.update_helpers(self.pyi_updater)

        helpers = {
            u'key_handler': self.key_handler,
            u'package_handler': self.package_handler,
            u'uploader': self.uploader,
            u'file_crypt': self.file_crypt,
            u'config': self.config,
            u'save': self.save_config,
        }

        self.keys_menu = keys.Keys(helpers)
        self.settings_menu = settings.Settings(helpers)
        self.sign_menu = sign.Sign(helpers)
        self.upload_menu = upload.Upload(helpers)

        header = u'Main Menu'
        options = [(u'Sign Updates', self.sign_menu),
                   (u'Upload', self.upload_menu), (u'Keys', self.keys_menu),
                   (u'Settings', self.settings_menu), (u'Quit', self.quit)]
        super(Worker, self).__init__(header, options)
def test_set_uploader_bad_settings():
    config = TConfig()
    config.ACCESS_KEY_ID = None
    config.SECRET_ACCESS_KEY = u'Not an actual secret'
    config.BUCKET_NAME = u'Bucket Name'
    s_nst = PyiUpdater(config)
    uploader = Uploader(s_nst)
    uploader.set_uploader(u's3')
Exemplo n.º 4
0
def setup_func():
    global test_data_dir

    config = TConfig()
    updater = PyiUpdater(config)
    ph = PackageHandler(updater)
    kh = KeyHandler(updater)
    kh.test = True
    ph.setup()
    kh.make_keys()
Exemplo n.º 5
0
def make_keys():
    pyi = PyiUpdater(DefaultConfig())
    key_handler = KeyHandler(pyi)
    # Making a new set of keys
    # Keys will be place in the keys
    # Directory, in the pyi-data folder
    # *** Should not be ran again after
    # you deploy your app!!!! ***
    # If you need to make new keys pass
    # overwrite=True to make_keys
    key_handler.make_keys()
Exemplo n.º 6
0
def test_setup():
    global test_data_dir

    config = TConfig()
    updater = PyiUpdater(config)
    ph = PackageHandler(updater)
    key_dir = os.path.join(ph.data_dir, u'keys')

    kh = KeyHandler(updater)
    kh.test = True
    assert os.path.exists(os.path.abspath(key_dir))
    assert kh.private_key_name == u'jms.pem'
    assert kh.public_key_name == u'jms.pub'
Exemplo n.º 7
0
def setup():
    # Setting up Config object
    default_config = DefaultConfig()

    # Initilizing Main object and configuring
    # in one step
    pyi = PyiUpdater(default_config)

    # Can also update config later
    pyi.update_config(default_config)

    # Initializing Package Handler & Key Handler
    # with config info
    package_handler = PackageHandler(pyi)
    key_handler = KeyHandler(pyi)

    # Can also be Initilized without config
    package_handler = PackageHandler()
    key_handler = KeyHandler()

    # Then update handlers with config later
    package_handler.init_app(pyi)
    key_handler.init_app(pyi)

    # Setting up work directories
    # Only need to run once on a new project but it's
    # ok if ran multipule times
    package_handler.setup()

    # Now place new packages in the folder named
    # "new" in the pyi-data directory
    # Package Archive filename should be in the form
    # AppName-platform-version.zip
    raw_input('Place updates in new folder then press enter.')
    # This updates the version file with the
    # new packages & moves them to the deploy folder.
    package_handler.process_packages()

    # This signs the update manifest & copies it
    # to the deploy folder
    key_handler.sign_update()
Exemplo n.º 8
0
def test_execution():
    global test_data_dir

    config = TConfig()
    updater = PyiUpdater(config)
    ph = PackageHandler(updater)
    kh = KeyHandler(updater)

    ph.setup()
    kh.test = True
    kh.make_keys()

    # Make zipfile
    with ChDir(test_data_dir):
        os.mkdir(u'test-app')
        with ChDir(u'test-app'):
            with open(u'app.txt', u'w') as f:
                f.write(u'I am so happy' * 1000)
        shutil.make_archive(u'Test App-mac-0.2.0', u'zip', u'test-app')
        shutil.move(u'Test App-mac-0.2.0.zip', u'new')
    ph.process_packages()
    kh.sign_update()
def test_dev_dir_none():
    updater = PyiUpdater(__name__)
    myconfig = TConfig()
    myconfig.APP_NAME = None
    updater.update_config(myconfig)
    assert updater.config[u'APP_NAME'] == u'PyiUpdater App'
Exemplo n.º 10
0
import sys

from nose.tools import raises, with_setup

sys.path.insert(
    0, os.path.join(os.path.dirname(os.path.dirname(__file__)), u'src'))

from pyi_updater import PyiUpdater
from pyi_updater.exceptions import UploaderError
from pyi_updater.uploader import Uploader

from tconfig import TConfig

my_config = TConfig()

updater = PyiUpdater(my_config)
uploader = Uploader(updater)


def setup_func():
    if not os.path.exists(uploader.deploy_dir):
        os.makedirs(uploader.deploy_dir)


def teardown_func():
    if os.path.exists(uploader.deploy_dir):
        shutil.rmtree(os.path.dirname(uploader.deploy_dir))


@raises(UploaderError)
def test_set_uploader_int_param():
def setup_func():
    config = TConfig()
    updater = PyiUpdater(config)
    ph = PackageHandler(updater)
    ph.setup()
Exemplo n.º 12
0
from nose import with_setup
import shutil
import sys

from jms_utils.paths import ChDir

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from pyi_updater import PyiUpdater
from pyi_updater.key_handler import KeyHandler
from pyi_updater.package_handler import PackageHandler
from pyi_updater.utils import remove_dot_files

from tconfig import TConfig

pyi_updater = PyiUpdater(TConfig())
kh = KeyHandler(pyi_updater)
kh.test = True
kh._add_filecrypt()
ph = PackageHandler(pyi_updater)

PYI_DATA = os.path.abspath(os.path.join(u'tests', u'pyi-data'))


def setup_func():
    ph.setup()
    kh.make_keys()
    test_data_dir = os.path.abspath(
        os.path.join(u'tests', u'test data', u'5.0'))
    with ChDir(test_data_dir):
        files = remove_dot_files(os.listdir(os.getcwd()))