How to use admin_available method in tempest

Best Python code snippet using tempest_python

qvm_prefs.py

Source:qvm_prefs.py Github

copy

Full Screen

1#!/usr/bin/python22# -*- coding: utf-8 -*-3#4# The Qubes OS Project, http://www.qubes-os.org5#6# Copyright (C) 2016 Marek Marczykowski-Górecki7# <marmarek@invisiblethingslab.com>8#9# This program is free software; you can redistribute it and/or10# modify it under the terms of the GNU General Public License11# as published by the Free Software Foundation; either version 212# of the License, or (at your option) any later version.13#14# This program is distributed in the hope that it will be useful,15# but WITHOUT ANY WARRANTY; without even the implied warranty of16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17# GNU General Public License for more details.18#19# You should have received a copy of the GNU General Public License20# along with this program; if not, write to the Free Software21# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,22# USA.23admin_available = True24try:25 import qubesadmin26 import qubesadmin.vm27except ImportError:28 admin_available = False29def __virtual__():30 return admin_available31def ext_pillar(minion_id, pillar, *args, **kwargs):32 app = qubesadmin.Qubes()33 try:34 vm = app.domains[minion_id]35 except KeyError:36 return {}37 qvm_pillar = {}38 if vm.qid == 0:39 qvm_pillar['type'] = 'admin'40 elif vm.klass == 'TemplateVM':41 qvm_pillar['type'] = 'template'42 elif vm.klass == 'StandaloneVM':43 qvm_pillar['type'] = 'standalone'44 else:45 qvm_pillar['type'] = 'app'46 if hasattr(vm, 'template'):47 qvm_pillar['template'] = vm.template.name48 if hasattr(vm, 'netvm'):49 qvm_pillar['netvm'] = str(vm.netvm)50 # TODO: consider other properties; target VM will learn them!...

Full Screen

Full Screen

03_root_path.py

Source:03_root_path.py Github

copy

Full Screen

1from os.path import join as urljoin2from ..utils import modify_key3def rule(services, settings):4 if not settings.ONE_DOMAIN_MODE:5 return6 API_URL = urljoin(settings.API_URL, "api")7 STORE_AVAILABLE = services.get("store")8 ADMIN_AVAILABLE = services.get("admin")9 BACKEND_AVAILABLE = services.get("backend")10 # replace defaults11 if STORE_AVAILABLE:12 with modify_key(services, "store", "environment") as environment:13 environment["BITCART_STORE_API_URL"] = API_URL14 if ADMIN_AVAILABLE:15 with modify_key(services, "admin", "environment") as environment:16 environment["BITCART_ADMIN_ROOTPATH"] = environment["BITCART_ADMIN_ROOTPATH"].replace("/", "/admin")17 environment["BITCART_ADMIN_API_URL"] = API_URL18 elif ADMIN_AVAILABLE:19 with modify_key(services, "admin", "environment") as environment:20 environment["BITCART_ADMIN_API_URL"] = API_URL21 if BACKEND_AVAILABLE and (ADMIN_AVAILABLE or STORE_AVAILABLE):22 with modify_key(services, "backend", "environment") as environment:...

Full Screen

Full Screen

test_user_manager.py

Source:test_user_manager.py Github

copy

Full Screen

1import pytest2import json3from api.models import User4from api import db5def test_no_admin_available(app, client):6 result = client.post(7 "/api/admin_available",8 headers={'Content-Type': 'application/json'}9 )10 assert result.json['admin_available'] == False11def test_admin_available(app, client):12 user = User(usr_role="admin")13 db.session.add(user)14 db.session.commit()15 result = client.post(16 "/api/admin_available",17 headers={'Content-Type': 'application/json'}18 )...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful