Exemplo n.º 1
0
    def test_all(self):
        Batch()
        from pyasm.web.web_init import WebInit
        WebInit().execute()

        test_env = UnittestEnvironment()
        test_env.create()

        self._test_command()
        self._test_trigger()
        trigger_key = "triggers:cache"
        Container.put(trigger_key, None)

        try:
            self._test_api_trigger()
            self._test_insert_trigger()

            # test copy project from template
            self._test_copy_project()
            # clear again for subsequent Client API test
            trigger_key = "triggers:cache"

            Container.put(trigger_key, None)
            trigger_key2 = Trigger.KEY
            Container.put(trigger_key2, None)
        finally:
            Project.set_project('unittest')
            test_env.delete()
Exemplo n.º 2
0
    def setUp(my):
        # start batch environment
        Batch()
        from pyasm.web.web_init import WebInit
        WebInit().execute()

        my.sample3d_env = Sample3dEnvironment(project_code='sample3d')
        my.sample3d_env.create()

        my.test_env = UnittestEnvironment()
        my.test_env.create()

    

        # set up the proper project_type, with the use the ProdDirNaming and ProdFileNaming
        search = Search('sthpw/project')
        search.add_filter('code', 'unittest')
        my.sobj = search.get_sobject()

        # store the original setting in your database
        my.original_proj_type_dict = {'dir_naming_cls': my.sobj.get_value('dir_naming_cls'),
                'file_naming_cls': my.sobj.get_value('file_naming_cls') }

        #my.transaction = Transaction.get(create=True)
        if my.sobj:
            my.sobj.set_value('dir_naming_cls', 'pyasm.prod.biz.ProdDirNaming')
            my.sobj.set_value('file_naming_cls', 'pyasm.prod.biz.ProdFileNaming')
            my.sobj.commit()
        else:
            my.sobj = SearchType.create('sthpw/project_type')
            my.sobj.set_value('dir_naming_cls', 'pyasm.prod.biz.ProdDirNaming')
            my.sobj.set_value('file_naming_cls', 'pyasm.prod.biz.ProdFileNaming')
            my.sobj.set_value('code', 'unittest')
            my.sobj.commit()
Exemplo n.º 3
0
    def setUp(self):
        # intialiaze the framework as a batch process
        batch = Batch()
        from pyasm.web.web_init import WebInit
        WebInit().execute()

        self.test_env = UnittestEnvironment()
        self.test_env.create()
Exemplo n.º 4
0
    def setUp(my):
        # intitialize the framework as a batch process
        my.batch = Batch()

        from pyasm.web.web_init import WebInit
        WebInit().execute()

        my.test_env = UnittestEnvironment()
        my.test_env.create()

        # remove any existing widget config entries left over
        old_wdg_configs = Search.eval("@SOBJECT(config/widget_config)")
        for item in old_wdg_configs:
            item.delete()
Exemplo n.º 5
0
    def test_all(my):
        Batch()
        from pyasm.web.web_init import WebInit
        WebInit().execute()

        test_env = UnittestEnvironment()
        test_env.create()
        my.transaction = Transaction.get(create=True)
        try:
            my._test_multiple_schema()
        finally:
            my.transaction.rollback()
            Project.set_project('unittest')

            test_env.delete()
Exemplo n.º 6
0
    def test_all(self):
        # intialiaze the framework as a batch process
        batch = Batch()
        from pyasm.web.web_init import WebInit
        WebInit().execute()

        self.test_env = UnittestEnvironment()
        self.test_env.create()
        #from pyasm.biz import Project
        #Project.set_project("unittest")

        try:
            self._test_transaction()
            self._test_undo()
            self._test_file_undo()
            self._test_debug_log()
        except:

            Project.set_project('unittest')
            self.test_env.delete()
Exemplo n.º 7
0
    def test_all(my):

        Batch()
        from pyasm.web.web_init import WebInit
        WebInit().execute()

        #TODO add the schema entry to the sample3d plugin first
        #sample3d_test_env = Sample3dEnvironment()
        #sample3d_test_env.create()

        test_env = UnittestEnvironment()
        test_env.create()
        my.transaction = Transaction.get(create=True)
        try:

            my.person = Person.create("Unit", "Test", "ComputerWorld",
                                      "Fake Unittest Person")
            my.search_type = my.person.get_search_type()
            my.search_id = my.person.get_id()
            my.search_code = my.person.get_value("code")
            my.context = "test"
            my.full_context = "test/subtest"

            my._test_instances()

            my._test_pipeline()
            my._test_pipeline_connects()

            my._test_schema()
            my._test_snapshot()
            my._test_level()
            my._test_naming_util()
            my._test_sobject_hierarchy()

            my._test_add_tasks()
            my._test_time()
        finally:
            my.transaction.rollback()
            Project.set_project('unittest')

            test_env.delete()
Exemplo n.º 8
0
    def test_all(my):

        Batch()
        from pyasm.web.web_init import WebInit
        WebInit().execute()

        test_env = UnittestEnvironment()
        test_env.create()
        my.transaction = Transaction.get(create=True)
        Project.set_project('unittest')
        try:
            my.person = Person.create("Unit", "Test", "ComputerWorld",
                                      "Fake Unittest Person")
            my._test_notification()

            my.transaction = Transaction.get(create=True)
            my._test_result()
        finally:
            my.transaction.rollback()
            test_env.delete()

        return
Exemplo n.º 9
0
    def test_all(self):
        # start batch environment
        Batch()
        from pyasm.web.web_init import WebInit
        WebInit().execute()


        sample3d_test_env = Sample3dEnvironment()
        sample3d_test_env.create()


        test_env = UnittestEnvironment()
        test_env.create()



        db_res = DbResource.get_default('unittest')
        sql = DbContainer.get(db_res)
        impl = sql.get_database_impl()
        db_type = impl.get_database_type()
        if db_type == "PostgreSQL":
            self.prefix = '''"unittest"."public".'''
            self.sthpw_prefix = '''"sthpw"."public".'''
        elif db_type == "Sqlite":
            self.prefix = ""
            self.sthpw_prefix = ""
        elif db_type == "SQLServer":
            self.prefix = '''"unittest"."dbo".'''
            self.sthpw_prefix = '''"sthpw"."dbo".'''
            
        else:
            self.prefix = '''"unittest".'''
            self.sthpw_prefix = '''"sthpw".'''




        self.transaction = Transaction.get(create=True)
        try:

            self.person = Person.create( "5", "a",
                    "ComputerWorld", "1")
            self.person = Person.create( "4", "b",
                    "ComputerWorld", "3")
            self.person = Person.create( "3", "c",
                    "ComputerWorld", "3")
            self.person = Person.create( "2", "d",
                    "ComputerWorld", "4") 
            self.person = Person.create( "1", "e",
                    "ComputerWorld", "5") 



            self._test_no_id()

            self._test_order_by()                               
            self._test_search_key()
            self._test_search()
            self._test_multi_db_subselect()

            # FIXME: this requires sample3d project
            self._test_search_other_project()
            self._test_search_type()
            self._test_metadata()
            self._test_search_type_existence()
            self._test_project()
            self._test_search_filter()
            self._test_dates_search()
            self._test_child_search()
            self._test_parent_search()
            self._test_add_column_search()
            self._test_commit()
            self._test_set_value()
            self._test_search_set_value()
            self._test_get_by_statement()

            self._test_views()


        finally:
            self.transaction.rollback()
            Project.set_project('unittest')

            test_env.delete()
            sample3d_test_env.delete()