예제 #1
0
파일: operations.py 프로젝트: ctasca/inviqa
    def run_prompt(self, fpath):
        """
        Provide list of available features directories and features
        """
        self.absolute_fpath = os.path.abspath(fpath)
        exclude = set(self.exclude_walk_dirs)


        for root, subdirs, files, in os.walk(self.absolute_fpath):
            subdirs[:] = [d for d in subdirs if d not in exclude]

            for name in files:
                ext = splitext(name)[1]
                if (ext != '.feature'):
                    continue
                fp = os.path.join(root, name)
                replace = self.absolute_fpath + os.sep
                fp = fp.replace(replace, '')
                self.features_list.append(fp)
            for name in subdirs:
                self.features_list.append(name)


        for feature in self.features_list:
            i = self.features_list.index(feature) + 1
            print str(c.get("[" + str(i) + "]")) + " " + feature

        self.selected = prompt('>>> Choose feature/features to run or press enter for entire suite')

        # when no features dir or feature is provided, run all in features path
        if (self.selected.isdigit() == False):
            self.path = fpath
예제 #2
0
파일: operations.py 프로젝트: ctasca/inviqa
 def shred(self):
     RemoteTaskNotifier(self.environment)
     remotefile_location = prompt('>>> Enter file location:')
     with cd(remotefile_location):
         run('ls')
         filename = prompt('>>> Enter file name to shred:')
         confirm_shred = inviqa_confirm("*** You are about to start shredding the file '%s'. Are you sure?" % (filename), False)
         if confirm_shred:
             sudo('shred -u -v %s' % (filename))
             fdisk = inviqa_confirm("*** Do you want to overwrite the free disk space?", False)
             if fdisk:
                 with cd('~'):
                     sudo('dd if=/dev/zero of=file.txt')
                     frm = inviqa_confirm("*** Do you want to delete file.txt?", False)
                     if frm:
                         sudo('rm file.txt')
예제 #3
0
파일: operations.py 프로젝트: ctasca/inviqa
    def run(self):
        """
         Runs behat selected features in specified path.
         """
        if self.path == False:
            puts("!!! Cannot list 'features' from specified path.")
            return 1

        profile  = prompt('>>> Enter Behat profile or press enter to run default profile')
        options  = prompt('>>> Enter any additional options for behat command or press enter')

        if re.match(r'^\d{1,}-\d{1,}', self.selected):
            range_split = self.selected.split('-')
            selected_list = range(int(range_split[0]), int(range_split[1]))
        else:
            selected_list = self.selected.split(' ')

        for selected in selected_list:
            selected = str(selected);

            if selected.isdigit():
                findex = int(selected.strip()) -1

            if selected.isdigit() == False:
                run_feature = ''
            else:
                run_feature = self.features_list[findex]

            line = prompt('>>> Enter line number, or press enter')

            if line:
                    run_feature = run_feature + ':' + line

            if run_feature != '':
                puts("*** Running feature: " + run_feature)
            else:
                puts("*** Running all features in suite")

            behat_command = "bin/behat features/%s %s" % (run_feature, options)

            if (profile):
                behat_command = "bin/behat -p %s features/%s %s" % (profile, run_feature, options)

            local(behat_command)
예제 #4
0
파일: operations.py 프로젝트: ctasca/inviqa
 def reverse(self):
     proxy = prompt('>>> Enter host (without http|https)')
     local('proxyreverse 8080,8443 %s' % (proxy))