def test_directory_fixer_home_direcotry_symbol():
    downlaods_dir = os.path.join(os.path.expanduser(u'~'), u'Downloads')
    assert downlaods_dir == _directory_fixer(u'~/Downloads')
def test_directory_fixer():
    assert u'/home/jms' == _directory_fixer(u'/home/jms')
def test_directory_fixer_home_shortcut():
    assert os.path.join(os.path.expanduser(u'~'),
                        u'Downloads') == _directory_fixer(u'~/Downloads')
    def initial_setup(self):
        log.debug(u'Starting initial setup')
        self.display_menu_header(u'Setup Assistant')
        self.display_msg(u'Let\'s begin...')

        self.config.APP_NAME = get_correct_answer(u'Please enter app name',
                                                  required=True)

        self.config.COMPANY_NAME = get_correct_answer(u'Please enter your '
                                                      'company or name',
                                                      required=True)

        self.config.DEV_DATA_DIR = cwd

        url = get_correct_answer(u'Enter a url to ping for updates.',
                                 required=True)
        self.config.UPDATE_URLS = [url]
        while 1:
            answer = ask_yes_no(u'Would you like to add another '
                                'url for backup?', default='no')
            if answer is True:
                url = get_correct_answer(u'Enter another url.',
                                         required=True)
                self.config.UPDATE_URLS.append(url)
            else:
                break

        self.config.UPDATE_PATCHES = ask_yes_no(u'Would you like to enable '
                                                'patch updates?',
                                                default='yes')

        answer1 = ask_yes_no(u'Would you like to add scp settings?',
                             default='no')

        answer2 = ask_yes_no(u'Would you like to add S3 settings?',
                             default='no')

        if answer1:
            self.config.REMOTE_DIR = get_correct_answer(u'Enter remote dir',
                                                        required=True)
            self.config.HOST = get_correct_answer(u'Enter host', required=True)

            self.config.USERNAME = get_correct_answer(u'Enter usernmae',
                                                      required=True)

            key_path = get_correct_answer(u'Enter path to ssh key',
                                          required=True)
            # Path to private key
            self.config.PASSWORD = _directory_fixer(key_path)

        if answer2:
            self.config.USERNAME = get_correct_answer(u'Enter access key ID',
                                                      required=True)
            self.config.PASSWORD = get_correct_answer(u'Enter secret '
                                                      'Access Key',
                                                      required=True)

            self.config.REMOTE_DIR = get_correct_answer(u'Enter bucket name',
                                                        required=True)

        password = verify_password(u'Enter password')
        self.file_crypt._update_timer()
        self.save_config(self.config, password)
        self.package_handler.setup()
        print(u'Making keys...')
        self.keys_menu.make_keys()
        self.display_menu_header(u'Setup Complete')
        self.display_msg(u'Now let\'s update some apps')
        time.sleep(3)
Example #5
0
def test_directory_fixer_home_direcotry_symbol():
    downlaods_dir = os.path.join(os.path.expanduser(u'~'), u'Downloads')
    assert downlaods_dir == _directory_fixer(u'~/Downloads')
Example #6
0
def test_directory_fixer_home_shortcut():
    assert os.path.join(os.path.expanduser(u'~'),
                        u'Downloads') == _directory_fixer(u'~/Downloads')
Example #7
0
def test_directory_fixer():
    assert u'/home/jms' == _directory_fixer(u'/home/jms')
    def initial_setup(self):
        log.debug(u'Starting initial setup')
        self.display_menu_header(u'Setup Assistant')
        self.display_msg(u'Let\'s begin...')

        self.config.APP_NAME = get_correct_answer(u'Please enter app name',
                                                  required=True)

        self.config.COMPANY_NAME = get_correct_answer(
            u'Please enter your '
            'company or name', required=True)

        self.config.DEV_DATA_DIR = cwd

        url = get_correct_answer(u'Enter a url to ping for updates.',
                                 required=True)
        self.config.UPDATE_URLS = [url]
        while 1:
            answer = ask_yes_no(
                u'Would you like to add another '
                'url for backup?',
                default='no')
            if answer is True:
                url = get_correct_answer(u'Enter another url.', required=True)
                self.config.UPDATE_URLS.append(url)
            else:
                break

        self.config.UPDATE_PATCHES = ask_yes_no(
            u'Would you like to enable '
            'patch updates?', default='yes')

        answer1 = ask_yes_no(u'Would you like to add scp settings?',
                             default='no')

        answer2 = ask_yes_no(u'Would you like to add S3 settings?',
                             default='no')

        if answer1:
            self.config.REMOTE_DIR = get_correct_answer(u'Enter remote dir',
                                                        required=True)
            self.config.HOST = get_correct_answer(u'Enter host', required=True)

            self.config.USERNAME = get_correct_answer(u'Enter usernmae',
                                                      required=True)

            key_path = get_correct_answer(u'Enter path to ssh key',
                                          required=True)
            # Path to private key
            self.config.PASSWORD = _directory_fixer(key_path)

        if answer2:
            self.config.USERNAME = get_correct_answer(u'Enter access key ID',
                                                      required=True)
            self.config.PASSWORD = get_correct_answer(
                u'Enter secret '
                'Access Key', required=True)

            self.config.REMOTE_DIR = get_correct_answer(u'Enter bucket name',
                                                        required=True)

        password = verify_password(u'Enter password')
        self.file_crypt._update_timer()
        self.save_config(self.config, password)
        self.package_handler.setup()
        print(u'Making keys...')
        self.keys_menu.make_keys()
        self.display_menu_header(u'Setup Complete')
        self.display_msg(u'Now let\'s update some apps')
        time.sleep(3)