当前位置: 首页>>代码示例>>Python>>正文


Python TestFactory.create_project方法代码示例

本文整理汇总了Python中tvb.tests.framework.core.test_factory.TestFactory.create_project方法的典型用法代码示例。如果您正苦于以下问题:Python TestFactory.create_project方法的具体用法?Python TestFactory.create_project怎么用?Python TestFactory.create_project使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tvb.tests.framework.core.test_factory.TestFactory的用法示例。


在下文中一共展示了TestFactory.create_project方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_remove_project_wrong_id

# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import create_project [as 别名]
 def test_remove_project_wrong_id(self):
     """
     Flow for deleting a project giving an un-existing id.
     """
     TestFactory.create_project(self.test_user, 'test_proj')
     projects = dao.get_projects_for_user(self.test_user.id)
     self.assertEqual(len(projects), 1, "Initializations failed!") 
     self.assertRaises(ProjectServiceException, self.project_service.remove_project, 99)   
开发者ID:sdiazpier,项目名称:tvb-framework,代码行数:10,代码来源:project_service_test.py

示例2: test_retrieve_projects_page2

# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import create_project [as 别名]
 def test_retrieve_projects_page2(self):
     """
     Test for retrieving the second page projects for a given user.
     """
     for i in range(PROJECTS_PAGE_SIZE + 3):
         TestFactory.create_project(self.test_user, 'test_proj' + str(i))
     projects, pages = self.project_service.retrieve_projects_for_user(self.test_user.id, 2)
     self.assertEqual(len(projects), (PROJECTS_PAGE_SIZE + 3) % PROJECTS_PAGE_SIZE, "Pagination inproper.")
     self.assertEqual(pages, 2, 'Wrong number of pages retrieved.')
开发者ID:sdiazpier,项目名称:tvb-framework,代码行数:11,代码来源:project_service_test.py

示例3: test_viewall_valid_data

# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import create_project [as 别名]
 def test_viewall_valid_data(self):
     """
     Create a bunch of projects and check that they are returned correctly.
     """
     project1 = TestFactory.create_project(self.test_user, 'prj1')
     TestFactory.create_project(self.test_user, 'prj2')
     TestFactory.create_project(self.test_user, 'prj3')
     result = self.project_c.viewall(selected_project_id=project1.id)
     projects_list = result['projectsList']
     ## Use this old version of SET builder, otherwise it will fain on Python 2.6
     self.assertEqual(set([prj.name for prj in projects_list]), {'prj1', 'prj2', 'prj3', 'Test'})
     self.assertEqual(result['page_number'], 1)
     self.assertEqual(result[common.KEY_PROJECT].name, 'prj1')
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:15,代码来源:project_controller_test.py

示例4: test_retrieve_1project_3usr

# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import create_project [as 别名]
 def test_retrieve_1project_3usr(self):
     """
     One user as admin, two users as members, getting projects for admin and for any of
     the members should return one.
     """
     member1 = TestFactory.create_user("member1")
     member2 = TestFactory.create_user("member2")
     TestFactory.create_project(self.test_user, 'Testproject', users=[member1.id, member2.id])
     projects = self.project_service.retrieve_projects_for_user(self.test_user.id, 1)[0]
     self.assertEqual(len(projects), 1, "Projects not retrieved properly!")
     projects = self.project_service.retrieve_projects_for_user(member1.id, 1)[0]
     self.assertEqual(len(projects), 1, "Projects not retrieved properly!")
     projects = self.project_service.retrieve_projects_for_user(member2.id, 1)[0]
     self.assertEqual(len(projects), 1, "Projects not retrieved properly!")
开发者ID:sdiazpier,项目名称:tvb-framework,代码行数:16,代码来源:project_service_test.py

示例5: setUp

# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import create_project [as 别名]
 def setUp(self):
     """
     Set up the context needed by the tests.
     """
     self.files_helper = FilesHelper()
     self.test_user = TestFactory.create_user()
     self.test_project = TestFactory.create_project(self.test_user, self.PROJECT_NAME)
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:9,代码来源:files_helper_test.py

示例6: setUp

# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import create_project [as 别名]
    def setUp(self):
        """ Prepare some entities to work with during tests:"""

        self.flow_service = FlowService()
        self.test_user = TestFactory.create_user()
        self.test_project = TestFactory.create_project(admin=self.test_user)
        ### Insert some starting data in the database.
        categ1 = model.AlgorithmCategory('one', True)
        self.categ1 = dao.store_entity(categ1)
        categ2 = model.AlgorithmCategory('two', rawinput=True)
        self.categ2 = dao.store_entity(categ2)

        group1 = model.AlgorithmGroup("test_module1", "classname1", categ1.id)
        self.algo_group1 = dao.store_entity(group1)
        group2 = model.AlgorithmGroup("test_module2", "classname2", categ2.id)
        self.algo_group2 = dao.store_entity(group2)
        group3 = model.AlgorithmGroup("test_module3", "classname3", categ1.id)
        self.algo_group3 = dao.store_entity(group3)

        group_v = model.AlgorithmGroup(TEST_ADAPTER_VALID_MODULE, TEST_ADAPTER_VALID_CLASS, categ2.id)
        self.algo_group_v = dao.store_entity(group_v)

        algo_v = model.Algorithm(self.algo_group_v.id, 'ident', name='', req_data='', param_name='', output='')
        self.algorithm_v = dao.store_entity(algo_v)

        algo1 = model.Algorithm(self.algo_group1.id, 'id', name='', req_data='', param_name='', output='')
        self.algorithm1 = dao.store_entity(algo1)
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:29,代码来源:flow_service_test.py

示例7: test_get_linkable_projects

# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import create_project [as 别名]
    def test_get_linkable_projects(self):
        """
        Test for retrieving the projects for a given user.
        """
        initial_projects = self.project_service.retrieve_projects_for_user(self.test_user.id)[0]
        self.assertEqual(len(initial_projects), 0, "Database was not reset!")
        test_proj = []
        user1 = TestFactory.create_user("another_user")
        for i in range(4):
            test_proj.append(TestFactory.create_project(self.test_user if i < 3 else user1, 'test_proj' + str(i)))

        project_storage = self.structure_helper.get_project_folder(test_proj[0])

        operation = TestFactory.create_operation(test_user=self.test_user, test_project=test_proj[0])

        project_storage = os.path.join(project_storage, str(operation.id))
        os.makedirs(project_storage)
        datatype = dao.store_entity(model.DataType(module="test_data", subject="subj1", 
                                                   state="test_state", operation_id=operation.id))
        linkable = self.project_service.get_linkable_projects_for_user(self.test_user.id, str(datatype.id))[0]
        self.assertEqual(len(linkable), 2, "Wrong count of link-able projects!")
        proj_names = [project.name for project in linkable]
        self.assertTrue(test_proj[1].name in proj_names)
        self.assertTrue(test_proj[2].name in proj_names)
        self.assertFalse(test_proj[3].name in proj_names)    
开发者ID:sdiazpier,项目名称:tvb-framework,代码行数:27,代码来源:project_service_test.py

示例8: setUp

# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import create_project [as 别名]
 def setUp(self):
     """
     Sets up the environment for running the tests;
     creates a test user and a test project, saves old configuration and imports a CFF data-set
     """
     self.test_user = TestFactory.create_user()
     self.test_project = TestFactory.create_project(self.test_user)
     TestFactory.import_cff(test_user=self.test_user, test_project=self.test_project)
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:10,代码来源:timeseries_metrics_adapter_test.py

示例9: setUp

# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import create_project [as 别名]
 def setUp(self):
     """
     Reset the database before each test.
     """
     self.clean_database()
     self.flow_service = FlowService()
     self.test_user = TestFactory.create_user()
     self.test_project = TestFactory.create_project(admin=self.test_user)
     self.operation = TestFactory.create_operation(test_user=self.test_user, test_project=self.test_project)
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:11,代码来源:mapping_test.py

示例10: setUp

# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import create_project [as 别名]
 def setUp(self):
     """
     Set up any additionally needed parameters.
     """
     self.clean_database()
     super(GenshiTestNDimensionArray, self).setUp()
     self.test_user = TestFactory.create_user()
     self.test_project = TestFactory.create_project(self.test_user)
     self.operation = TestFactory.create_operation(test_user=self.test_user, test_project=self.test_project)
开发者ID:gummadhav,项目名称:tvb-framework,代码行数:11,代码来源:genshi_test.py

示例11: setUp

# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import create_project [as 别名]
 def setUp(self):
     """
     Reset the database before each test.
     """
     self.clean_database()
     initialize_storage()
     self.test_user = TestFactory.create_user()
     self.test_project = TestFactory.create_project(self.test_user)
     self.operation_service = OperationService()
     self.backup_hdd_size = TvbProfile.current.MAX_DISK_SPACE
开发者ID:lcosters,项目名称:tvb-framework,代码行数:12,代码来源:operation_service_test.py

示例12: test_create_project_happy_flow

# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import create_project [as 别名]
 def test_create_project_happy_flow(self):
     """
     Standard flow for creating a new project.
     """
     user1 = TestFactory.create_user('test_user1')
     user2 = TestFactory.create_user('test_user2')
     initial_projects = dao.get_projects_for_user(self.test_user.id)
     self.assertEqual(len(initial_projects), 0, "Database reset probably failed!")
     TestFactory.create_project(self.test_user, 'test_project', users=[user1.id, user2.id])
     resulting_projects = dao.get_projects_for_user(self.test_user.id)
     self.assertEqual(len(resulting_projects), 1, "Project with valid data not inserted!")  
     project = resulting_projects[0]
     if project.name == "test_project":
         self.assertEqual(project.description, "description", "Description do no match")
         users_for_project = dao.get_members_of_project(project.id)
         for user in users_for_project:
             self.assertTrue(user.id in [user1.id, user2.id], "Users not stored properly.")
     self.assertTrue(os.path.exists(os.path.join(TvbProfile.current.TVB_STORAGE, FilesHelper.PROJECTS_FOLDER,
                                                 "test_project")), "Folder for project was not created")
开发者ID:sdiazpier,项目名称:tvb-framework,代码行数:21,代码来源:project_service_test.py

示例13: setUp

# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import create_project [as 别名]
    def setUp(self):
        """ Prepare some entities to work with during tests:"""

        self.flow_service = FlowService()
        self.test_user = TestFactory.create_user()
        self.test_project = TestFactory.create_project(admin=self.test_user)

        category = dao.get_uploader_categories()[0]
        self.algorithm = dao.store_entity(model.Algorithm(TEST_ADAPTER_VALID_MODULE,
                                                          TEST_ADAPTER_VALID_CLASS, category.id))
开发者ID:gummadhav,项目名称:tvb-framework,代码行数:12,代码来源:flow_service_test.py

示例14: test_edit_project_unexisting

# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import create_project [as 别名]
 def test_edit_project_unexisting(self):
     """
     Trying to edit an un-existing project.
     """
     selected_project = TestFactory.create_project(self.test_user, 'test_proj')
     self.structure_helper.get_project_folder(selected_project)
     initial_projects = dao.get_projects_for_user(self.test_user.id)
     self.assertEqual(len(initial_projects), 1, "Database initialization probably failed!")
     data = dict(name="test_project", description="test_description", users=[])
     self.assertRaises(ProjectServiceException, self.project_service.store_project,
                       self.test_user, False, 99, **data)
开发者ID:sdiazpier,项目名称:tvb-framework,代码行数:13,代码来源:project_service_test.py

示例15: setUp

# 需要导入模块: from tvb.tests.framework.core.test_factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.test_factory.TestFactory import create_project [as 别名]
    def setUp(self):
        """
        Sets up the environment for running the tests;
        cleans the database before testing and saves config file;
        creates a test user, a test project;
        creates burst, flow, operation and workflow services

        """
        self.clean_database()
        self.test_user = TestFactory.create_user()
        self.test_project = TestFactory.create_project(self.test_user)
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:13,代码来源:burst_service_test.py


注:本文中的tvb.tests.framework.core.test_factory.TestFactory.create_project方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。