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


Python TestFactory.create_project方法代码示例

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


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

示例1: test_retrieve_projects_page2

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.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)
     assert len(projects) == (PROJECTS_PAGE_SIZE + 3) % PROJECTS_PAGE_SIZE, "Pagination inproper."
     assert pages == 2, 'Wrong number of pages retrieved.'
开发者ID:maedoc,项目名称:tvb-framework,代码行数:11,代码来源:project_service_test.py

示例2: test_remove_project_wrong_id

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.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)
     assert len(projects) == 1, "Initializations failed!"
     with pytest.raises(ProjectServiceException):
         self.project_service.remove_project(99)   
开发者ID:maedoc,项目名称:tvb-framework,代码行数:11,代码来源:project_service_test.py

示例3: test_viewall_valid_data

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.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
     assert set([prj.name for prj in projects_list]) == {'prj1', 'prj2', 'prj3', 'Test'}
     assert result['page_number'] == 1
     assert result[common.KEY_PROJECT].name == 'prj1'
开发者ID:maedoc,项目名称:tvb-framework,代码行数:15,代码来源:project_controller_test.py

示例4: test_retrieve_1project_3usr

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.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]
     assert len(projects) == 1, "Projects not retrieved properly!"
     projects = self.project_service.retrieve_projects_for_user(member1.id, 1)[0]
     assert len(projects) == 1, "Projects not retrieved properly!"
     projects = self.project_service.retrieve_projects_for_user(member2.id, 1)[0]
     assert len(projects) == 1, "Projects not retrieved properly!"
开发者ID:maedoc,项目名称:tvb-framework,代码行数:16,代码来源:project_service_test.py

示例5: test_get_linkable_projects

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.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]
        assert 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]
        assert len(linkable) == 2, "Wrong count of link-able projects!"
        proj_names = [project.name for project in linkable]
        assert test_proj[1].name in proj_names
        assert test_proj[2].name in proj_names
        assert not test_proj[3].name in proj_names
开发者ID:maedoc,项目名称:tvb-framework,代码行数:27,代码来源:project_service_test.py

示例6: transactional_setup_method

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.factory.TestFactory import create_project [as 别名]
 def transactional_setup_method(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:maedoc,项目名称:tvb-framework,代码行数:10,代码来源:timeseries_metrics_adapter_test.py

示例7: setup_method

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.factory.TestFactory import create_project [as 别名]
 def setup_method(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:maedoc,项目名称:tvb-framework,代码行数:11,代码来源:mapping_test.py

示例8: setup_method

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.factory.TestFactory import create_project [as 别名]
 def setup_method(self):
     """
     Set up any additionally needed parameters.
     """
     self.clean_database()
     super(TestGenshiNDimensionArray, self).setup_method()
     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:the-virtual-brain,项目名称:tvb-framework,代码行数:11,代码来源:genshi_test.py

示例9: setup_method

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.factory.TestFactory import create_project [as 别名]
 def setup_method(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:maedoc,项目名称:tvb-framework,代码行数:12,代码来源:operation_service_test.py

示例10: test_create_project_happy_flow

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.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)
     assert 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)
     assert len(resulting_projects) == 1, "Project with valid data not inserted!"
     project = resulting_projects[0]
     if project.name == "test_project":
         assert project.description == "description", "Description do no match"
         users_for_project = dao.get_members_of_project(project.id)
         for user in users_for_project:
             assert user.id in [user1.id, user2.id], "Users not stored properly."
     assert os.path.exists(os.path.join(TvbProfile.current.TVB_STORAGE, FilesHelper.PROJECTS_FOLDER,
                                                 "test_project")), "Folder for project was not created"
开发者ID:maedoc,项目名称:tvb-framework,代码行数:21,代码来源:project_service_test.py

示例11: setup_method

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.factory.TestFactory import create_project [as 别名]
    def setup_method(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:maedoc,项目名称:tvb-framework,代码行数:13,代码来源:burst_service_test.py

示例12: test_edit_project_unexisting

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.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)
     assert len(initial_projects) == 1, "Database initialization probably failed!"
     data = dict(name="test_project", description="test_description", users=[])
     with pytest.raises(ProjectServiceException):
         self.project_service.store_project(self.test_user, False, 99, **data)
开发者ID:maedoc,项目名称:tvb-framework,代码行数:13,代码来源:project_service_test.py

示例13: test_project_disk_size

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.factory.TestFactory import create_project [as 别名]
    def test_project_disk_size(self):
        project1 = TestFactory.create_project(self.test_user, 'test_proj1')
        zip_path = os.path.join(os.path.dirname(tvb_data.__file__), 'connectivity', 'connectivity_66.zip')
        TestFactory.import_zip_connectivity(self.test_user, project1, 'testSubject', zip_path)

        project2 = TestFactory.create_project(self.test_user, 'test_proj2')
        TestFactory.import_cff(test_user=self.test_user, test_project=project2)

        projects = self.project_service.retrieve_projects_for_user(self.test_user.id)[0]
        assert projects[0].disk_size != projects[1].disk_size, "projects should have different size"

        for project in projects:
            assert 0 != project.disk_size
            assert '0.0 KiB' != project.disk_size_human

            prj_folder = self.structure_helper.get_project_folder(project)
            actual_disk_size = self.compute_recursive_h5_disk_usage(prj_folder)[0]

            ratio = float(actual_disk_size) / project.disk_size
            msg = "Real disk usage: %s The one recorded in the db : %s" % (actual_disk_size, project.disk_size)
            assert ratio < 1.4, msg
开发者ID:maedoc,项目名称:tvb-framework,代码行数:23,代码来源:project_service_test.py

示例14: test_getmemberspage

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.factory.TestFactory import create_project [as 别名]
 def test_getmemberspage(self):
     """
     Get the first page of the members page.
     """
     users_count = dao.get_all_users(is_count=True)
     user = TestFactory.create_user('usr', 'pass')
     test_project = TestFactory.create_project(user, 'new_name')
     result = self.project_c.getmemberspage(0, test_project.id)
     assert result['usersMembers'] == []
     # Same users as before should be available since we created new one
     # as owned for the project.
     assert len(result['usersList']) == users_count
开发者ID:maedoc,项目名称:tvb-framework,代码行数:14,代码来源:project_controller_test.py

示例15: transactional_setup_method

# 需要导入模块: from tvb.tests.framework.core.factory import TestFactory [as 别名]
# 或者: from tvb.tests.framework.core.factory.TestFactory import create_project [as 别名]
    def transactional_setup_method(self):
        _, self.connectivity = DatatypesFactory().create_connectivity()
        self.test_user = TestFactory.create_user(username="test_user")
        self.test_project = TestFactory.create_project(self.test_user, "Test")

        burst_conf = BurstConfiguration(self.test_project.id)
        burst_conf._simulator_configuration = self.CONF_HOPFIELD_HEUN_STOCH_RANGES
        burst_conf.prepare_after_load()
        burst_conf.simulator_configuration['connectivity'] = {'value': self.connectivity.gid}

        self.s_manager = SerializationManager(burst_conf)
        self.empty_manager = SerializationManager(BurstConfiguration(None))
开发者ID:maedoc,项目名称:tvb-framework,代码行数:14,代码来源:serialization_manager_test.py


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