當前位置: 首頁>>代碼示例>>Python>>正文


Python base.TestCase方法代碼示例

本文整理匯總了Python中tests.base.TestCase方法的典型用法代碼示例。如果您正苦於以下問題:Python base.TestCase方法的具體用法?Python base.TestCase怎麽用?Python base.TestCase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tests.base的用法示例。


在下文中一共展示了base.TestCase方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from tests import base [as 別名]
# 或者: from tests.base import TestCase [as 別名]
def setUp(self):
        base.TestCase.setUp(self)

        users = ({
            'email': '[email protected]',
            'login': 'goodlogin',
            'firstName': 'First',
            'lastName': 'Last',
            'password': 'goodpassword'
        }, {
            'email': '[email protected]',
            'login': 'regularuser',
            'firstName': 'First',
            'lastName': 'Last',
            'password': 'goodpassword'
        })
        self.admin, self.user = [
            self.model('user').createUser(**user) for user in users]
        folders = self.model('folder').childFolders(
            self.admin, 'user', user=self.admin)
        for folder in folders:
            if folder['name'] == 'Public':
                self.publicFolder = folder
        self.item1 = self.model('item').createItem(
            'item1', creator=self.admin, folder=self.publicFolder)
        self.item2 = self.model('item').createItem(
            'item2', creator=self.admin, folder=self.publicFolder) 
開發者ID:OpenGeoscience,項目名稱:database_assetstore,代碼行數:29,代碼來源:file_test.py

示例2: setUp

# 需要導入模塊: from tests import base [as 別名]
# 或者: from tests.base import TestCase [as 別名]
def setUp(self):
        base.TestCase.setUp(self)

        adminUser = {
            'email': '[email protected]',
            'login': 'goodlogin',
            'firstName': 'First',
            'lastName': 'Last',
            'password': 'goodpassword'
        }
        self.admin = self.model('user').createUser(**adminUser)
        folders = self.model('folder').childFolders(
            self.admin, 'user', user=self.admin)
        for folder in folders:
            if folder['name'] == 'Public':
                self.publicFolder = folder

        resp = self.request(method='POST', path='/assetstore', user=self.admin,
                            params=self.dbParams)
        self.assertStatusOk(resp)
        self.assetstore1 = resp.json

        params = {
            'parentId': str(self.publicFolder['_id']),
            'parentType': 'folder'
        }
        resp = self.request(
            path='/database_assetstore/%s/import' % str(
                self.assetstore1['_id']),
            method='PUT', user=self.admin, params=params)
        self.assertStatusOk(resp)
        self.dbItem = list(self.model('item').textSearch(
            'permits', user=self.admin, limit=1))[0]
        self.dbFile = list(self.model('item').childFiles(item=self.dbItem))[0]
        self.dbFileId = str(self.dbFile['_id']) 
開發者ID:OpenGeoscience,項目名稱:database_assetstore,代碼行數:37,代碼來源:dbs_mongo_test.py

示例3: setUp

# 需要導入模塊: from tests import base [as 別名]
# 或者: from tests.base import TestCase [as 別名]
def setUp(self):
        base.TestCase.setUp(self)

        adminUser = {
            'email': '[email protected]',
            'login': 'goodlogin',
            'firstName': 'First',
            'lastName': 'Last',
            'password': 'goodpassword'
        }
        self.admin = self.model('user').createUser(**adminUser)
        folders = self.model('folder').childFolders(
            self.admin, 'user', user=self.admin)
        for folder in folders:
            if folder['name'] == 'Public':
                self.publicFolder = folder

        resp = self.request(method='POST', path='/assetstore', user=self.admin,
                            params=self.dbParams)
        self.assertStatusOk(resp)
        self.assetstore1 = resp.json

        params = {
            'parentId': str(self.publicFolder['_id']),
            'parentType': 'folder',
            'table': json.dumps([{
                'name': 'drerio_gene_vega__gene__main',
                'database': 'vega_mart_88',
                }]),
        }
        resp = self.request(
            path='/database_assetstore/%s/import' % str(
                self.assetstore1['_id']),
            method='PUT', user=self.admin, params=params)
        self.assertStatusOk(resp)
        self.dbItem = list(self.model('item').textSearch(
            'drerio_gene_vega__gene__main', user=self.admin, limit=1))[0]
        self.dbFile = list(self.model('item').childFiles(item=self.dbItem))[0]
        self.dbFileId = str(self.dbFile['_id']) 
開發者ID:OpenGeoscience,項目名稱:database_assetstore,代碼行數:41,代碼來源:dbs_mysql_test.py

示例4: setUp

# 需要導入模塊: from tests import base [as 別名]
# 或者: from tests.base import TestCase [as 別名]
def setUp(self):
        # adding and removing docker images and using generated rest endpoints
        # requires admin access
        base.TestCase.setUp(self)
        admin = {
            'email': '[email protected]',
            'login': 'adminlogin',
            'firstName': 'Admin',
            'lastName': 'Last',
            'password': 'adminpassword',
            'admin': True
        }
        self.admin = self.model('user').createUser(**admin) 
開發者ID:girder,項目名稱:slicer_cli_web,代碼行數:15,代碼來源:docker_test.py

示例5: setUp

# 需要導入模塊: from tests import base [as 別名]
# 或者: from tests.base import TestCase [as 別名]
def setUp(self):
        base.TestCase.setUp(self)

        users = ({
            'email': '[email protected]',
            'login': 'goodlogin',
            'firstName': 'First',
            'lastName': 'Last',
            'password': 'goodpassword'
        }, {
            'email': '[email protected]',
            'login': 'regularuser',
            'firstName': 'First',
            'lastName': 'Last',
            'password': 'goodpassword'
        })
        self.admin, self.user = [
            self.model('user').createUser(**user) for user in users]
        folders = self.model('folder').childFolders(
            self.admin, 'user', user=self.admin)
        for folder in folders:
            if folder['name'] == 'Public':
                self.publicFolder = folder
            elif folder['name'] == 'Private':
                self.privateFolder = folder
        self.item1 = self.model('item').createItem(
            'item1', creator=self.admin, folder=self.publicFolder)
        self.item2 = self.model('item').createItem(
            'item2', creator=self.admin, folder=self.publicFolder)
        # Define locations for the default assetstores
        self.dbParams = {
            'type': AssetstoreType.DATABASE,
            'name': 'Test Assetstore',
            'dbtype': 'sqlalchemy_postgres',
            'dburi': os.environ.get(
                'GIRDER_DATABASE_ASSETSTORE_POSTGRES_DB',
                'postgresql://[email protected]/sampledb'),
        }
        self.dbParams2 = {
            'type': AssetstoreType.DATABASE,
            'name': 'All Mongo Assetstores',
            'dburi': '/'.join(os.environ.get('GIRDER_TEST_DB').split('/')[:-1])
        }
        self.dbParams3 = {
            'type': AssetstoreType.DATABASE,
            'name': 'One Mongo Assetstores',
            'dburi': os.environ.get('GIRDER_TEST_DB')
        } 
開發者ID:OpenGeoscience,項目名稱:database_assetstore,代碼行數:50,代碼來源:assetstore_test.py


注:本文中的tests.base.TestCase方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。