Ejemplo n.º 1
0
def make_job_template(session,
                      org=None,
                      loc=None,
                      force_context=True,
                      **kwargs):
    """Creates a job template"""
    create_args = {
        u'name': None,
        u'template_content': None,
        u'template_type': 'file',
        u'default': None,
        u'audit_comment': None,
        u'job_category': None,
        u'description_format': None,
        u'provider_type': None,
        u'effective_user_value': None,
        u'current_user': None,
        u'overridable': None,
        u'snippet': None,
    }
    page = session.nav.go_to_job_templates
    core_factory(create_args,
                 kwargs,
                 session,
                 page,
                 org=org,
                 loc=loc,
                 force_context=force_context)
    JobTemplate(session.browser).create(**create_args)
Ejemplo n.º 2
0
    def __enter__(self):
        if settings.browser == 'docker':
            self._docker_browser = DockerBrowser(name=self.test.id())
            self._docker_browser.start()
            self.browser = self._docker_browser.webdriver
        else:
            self.browser = browser()

        # for compatibility purposes
        self.test.browser = self.browser

        self.browser.foreman_user = self.test.foreman_user
        self.browser.foreman_password = self.test.foreman_password

        if self._user is None:
            self._user = getattr(self.browser, 'foreman_user',
                                 settings.server.admin_username)

        if self._password is None:
            self._password = getattr(self.browser, 'foreman_password',
                                     settings.server.admin_password)

        self.browser.maximize_window()
        self.browser.get(settings.server.get_url())
        # Workaround 'Certificate Error' screen on Microsoft Edge
        if (self.test.driver_name == 'edge'
                and 'Certificate Error' in self.browser.title
                or 'Login' not in self.browser.title):
            self.browser.get(
                "javascript:document.getElementById('invalidcert_continue')"
                ".click()")

        self.test.addCleanup(self.test._saucelabs_test_result,
                             self.browser.session_id)

        # Library methods
        self.activationkey = ActivationKey(self.browser)
        self.architecture = Architecture(self.browser)
        self.bookmark = Bookmark(self.browser)
        self.container = Container(self.browser)
        self.compute_profile = ComputeProfile(self.browser)
        self.compute_resource = ComputeResource(self.browser)
        self.contenthost = ContentHost(self.browser)
        self.configgroups = ConfigGroups(self.browser)
        self.content_views = ContentViews(self.browser)
        self.dashboard = Dashboard(self.browser)
        self.dockertag = DockerTag(self.browser)
        self.domain = Domain(self.browser)
        self.errata = Errata(self.browser)
        self.discoveredhosts = DiscoveredHosts(self.browser)
        self.discoveryrules = DiscoveryRules(self.browser)
        self.environment = Environment(self.browser)
        self.gpgkey = GPGKey(self.browser)
        self.hardwaremodel = HardwareModel(self.browser)
        self.hostcollection = HostCollection(self.browser)
        self.hostgroup = Hostgroup(self.browser)
        self.hosts = Hosts(self.browser)
        self.job = Job(self.browser)
        self.jobtemplate = JobTemplate(self.browser)
        self.ldapauthsource = LdapAuthSource(self.browser)
        self.lifecycleenvironment = LifecycleEnvironment(self.browser)
        self.location = Location(self.browser)
        self.login = Login(self.browser)
        self.medium = Medium(self.browser)
        self.my_account = MyAccount(self.browser)
        self.navigator = Navigator(self.browser)
        self.nav = self.navigator  # for compatibility purposes
        self.user = User(self.browser)
        self.operatingsys = OperatingSys(self.browser)
        self.org = Org(self.browser)
        self.oscapcontent = OpenScapContent(self.browser)
        self.oscappolicy = OpenScapPolicy(self.browser)
        self.oscapreports = OpenScapReports(self.browser)
        self.package = Package(self.browser)
        self.partitiontable = PartitionTable(self.browser)
        self.puppetclasses = PuppetClasses(self.browser)
        self.puppetmodule = PuppetModule(self.browser)
        self.products = Products(self.browser)
        self.registry = Registry(self.browser)
        self.repository = Repos(self.browser)
        self.rhai = RHAI(self.browser)
        self.role = Role(self.browser)
        self.settings = Settings(self.browser)
        self.sc_parameters = SmartClassParameter(self.browser)
        self.smart_variable = SmartVariable(self.browser)
        self.subnet = Subnet(self.browser)
        self.subscriptions = Subscriptions(self.browser)
        self.sync = Sync(self.browser)
        self.syncplan = Syncplan(self.browser)
        self.task = Task(self.browser)
        self.template = Template(self.browser)
        self.trend = Trend(self.browser)
        self.usergroup = UserGroup(self.browser)

        # for compatibility purposes
        for attr in ('activationkey', 'architecture', 'bookmark', 'container',
                     'compute_profile', 'compute_resource', 'contenthost',
                     'configgroups', 'content_views', 'dashboard', 'dockertag',
                     'domain', 'errata', 'discoveredhosts', 'discoveryrules',
                     'environment', 'gpgkey', 'hardwaremodel',
                     'hostcollection', 'hostgroup', 'hosts', 'job',
                     'jobtemplate', 'ldapauthsource', 'lifecycleenvironment',
                     'location', 'login', 'medium', 'my_account', 'navigator',
                     'nav', 'user', 'operatingsys', 'org', 'oscapcontent',
                     'oscappolicy', 'oscapreports', 'package',
                     'partitiontable', 'puppetclasses', 'puppetmodule',
                     'products', 'registry', 'repository', 'rhai', 'role',
                     'settings', 'sc_parameters', 'smart_variable', 'subnet',
                     'subscriptions', 'sync', 'syncplan', 'task', 'template',
                     'trend', 'usergroup'):
            setattr(self.test, attr, getattr(self, attr))

        self.login.login(self._user, self._password)
        return self
Ejemplo n.º 3
0
    def setUp(self):  # noqa
        """We do want a new browser instance for every test."""
        super(UITestCase, self).setUp()
        if settings.browser == 'docker':
            self._docker_browser = DockerBrowser()
            self._docker_browser.start()
            self.browser = self._docker_browser.webdriver
            self.addCleanup(self._docker_browser.stop)
        else:
            self.browser = browser()
            self.addCleanup(self.browser.quit)
        self.browser.maximize_window()
        self.browser.get(settings.server.get_url())

        self.browser.foreman_user = self.foreman_user
        self.browser.foreman_password = self.foreman_password

        self.addCleanup(self._saucelabs_test_result)
        self.addCleanup(self.take_screenshot)

        # Library methods
        self.activationkey = ActivationKey(self.browser)
        self.architecture = Architecture(self.browser)
        self.bookmark = Bookmark(self.browser)
        self.container = Container(self.browser)
        self.compute_profile = ComputeProfile(self.browser)
        self.compute_resource = ComputeResource(self.browser)
        self.contenthost = ContentHost(self.browser)
        self.configgroups = ConfigGroups(self.browser)
        self.content_views = ContentViews(self.browser)
        self.dockertag = DockerTag(self.browser)
        self.domain = Domain(self.browser)
        self.errata = Errata(self.browser)
        self.discoveredhosts = DiscoveredHosts(self.browser)
        self.discoveryrules = DiscoveryRules(self.browser)
        self.environment = Environment(self.browser)
        self.gpgkey = GPGKey(self.browser)
        self.hardwaremodel = HardwareModel(self.browser)
        self.hostcollection = HostCollection(self.browser)
        self.hostgroup = Hostgroup(self.browser)
        self.hosts = Hosts(self.browser)
        self.job = Job(self.browser)
        self.jobtemplate = JobTemplate(self.browser)
        self.ldapauthsource = LdapAuthSource(self.browser)
        self.lifecycleenvironment = LifecycleEnvironment(self.browser)
        self.location = Location(self.browser)
        self.login = Login(self.browser)
        self.medium = Medium(self.browser)
        self.navigator = Navigator(self.browser)
        self.user = User(self.browser)
        self.operatingsys = OperatingSys(self.browser)
        self.org = Org(self.browser)
        self.oscapcontent = OpenScapContent(self.browser)
        self.oscappolicy = OpenScapPolicy(self.browser)
        self.oscapreports = OpenScapReports(self.browser)
        self.package = Package(self.browser)
        self.partitiontable = PartitionTable(self.browser)
        self.puppetclasses = PuppetClasses(self.browser)
        self.products = Products(self.browser)
        self.registry = Registry(self.browser)
        self.repository = Repos(self.browser)
        self.rhai = RHAI(self.browser)
        self.role = Role(self.browser)
        self.settings = Settings(self.browser)
        self.smart_variable = SmartVariable(self.browser)
        self.subnet = Subnet(self.browser)
        self.subscriptions = Subscriptions(self.browser)
        self.sync = Sync(self.browser)
        self.syncplan = Syncplan(self.browser)
        self.systemgroup = SystemGroup(self.browser)
        self.template = Template(self.browser)
        self.trend = Trend(self.browser)
        self.user = User(self.browser)
        self.usergroup = UserGroup(self.browser)