new feature for shell. Create_client

This commit is contained in:
Cayo Puigdefabregas 2020-07-23 17:44:24 +02:00
parent 114613ddf7
commit 9e57b0aee7
1 changed files with 7 additions and 1 deletions

View File

@ -13,12 +13,13 @@ from teal.teal import Teal
from teal.db import SchemaSQLAlchemy
from ereuse_devicehub.auth import Auth
from ereuse_devicehub.client import Client
from ereuse_devicehub.client import Client, UserClient
from ereuse_devicehub.config import DevicehubConfig
from ereuse_devicehub.db import db
from ereuse_devicehub.dummy.dummy import Dummy
from ereuse_devicehub.resources.device.search import DeviceSearch
from ereuse_devicehub.resources.inventory import Inventory, InventoryDef
from ereuse_devicehub.resources.user import User
from ereuse_devicehub.templating import Environment
@ -151,3 +152,8 @@ class Devicehub(Teal):
inv = g.inventory = Inventory.current # type: Inventory
g.tag_provider = DevicehubClient(base_url=inv.tag_provider,
token=DevicehubClient.encode_token(inv.tag_token))
def create_client(self, email='user@dhub.com', password='1234'):
client = UserClient(self, email, password, response_wrapper=self.response_class)
client.login()
return client