Example #1
0
 def test_component_catalog(self):
     """ Тестируем компонент каталога."""
     if ic.Login('user', None, prj_dir):
         cat = ic.metadata.THIS.mtd.testcatalog.ObjectCatalog.create()
         print('--- cat=', cat.ctg_refresh)
         cat.table
         ic.Logout()
Example #2
0
def test2():
    """
    Тестирование.
    """
    import ic
    THIS_PRJ_DIR = os.path.dirname(os.getcwd())

    try:
        # Сразу установить режим отладки для отображения всех
        # вспомогательных сообщений
        ic.utils.ic_mode.setDebugMode()
        ic.log.init(ic.config)

        print('LOGIN PROJECT:', THIS_PRJ_DIR)
        if ic.Login('test_user', '', THIS_PRJ_DIR, True):
            print('LOGIN - OK')
            print('ENVIRONMENT:')
            ic.printEnvironmentTable()
            print('START TESTS...')

            sprav_manager = ic.metadata.THIS.mtd.kladr_rf.create()
            sprav = sprav_manager.getSpravByName('nas_punkts')

            print('RESULT CODE:', getSpravChoiceListDlg(sprav=sprav))
            print('...STOP TESTS')
        else:
            print('LOGIN - FAILED')
        ic.Logout()
    except:
        ic.Logout()
        raise
Example #3
0
def test_all():
    """
    Запустить все тесты.
    """
    try:
        #Сразу установить режим отладки для отображения всех
        #вспомогательных сообщений
        ic.utils.ic_mode.setDebugMode()

        print('LOGIN PROJECT:', THIS_PRJ_DIR)
        if ic.Login('tester', '', THIS_PRJ_DIR, True):
            print('LOGIN - OK')
            print('ENVIRONMENT:')
            ic.printEnvironmentTable()
            print('START ALL TESTS...')
            test_icworkobj.testComponent()
            test_icregister.testComponent()
            test_icregister.testComponentAccumulating()
            print('...STOP ALL TESTS')
        else:
            print('LOGIN - FAILED')
        ic.Logout()
    except:
        ic.Logout()
        raise
Example #4
0
def test():
    """
    Тестовая функция.
    """
    import ic
    ok_login = ic.Login('test', '', 'c:/defis/Registr/Registr', True)
    print('START SpravTreeComboCtrl TEST ... Login:'******'Sprav', 'StdCls', None, 'registr_nsi.mtd', 'Registr'), )

        frame = wx.Frame(None)

        tree_combo_ctrl = icSpravTreeComboCtrlPrototype(sprav_psp,
                                                        None,
                                                        True,
                                                        parent=frame,
                                                        size=wx.Size(200, -1),
                                                        level_enable=1,
                                                        popup_type=1)
        tree_combo_ctrl.set_label_func(tree_combo_ctrl.getLabel_s1)
        tree_combo_ctrl.set_selected_sprav_code(
            u'PA110020010,PA110020020,PA110020030', 's1')
        button = wx.Button(frame, pos=wx.Point(10, 100))
        frame.Show()
        ic.getKernel().MainLoop()
        ic.Logout()
        print('STOP SpravTreeComboCtrl TEST ... OK')
Example #5
0
 def test_get_object_psp(self):
     """ Тестируем функцию доступа к объекту данных по паспорту."""
     import ic.db.icdbpassport as dbp
     if ic.Login('user', None, prj_dir):
         psp = dbp.icDBPassport(('catalog', 1, None))
         r = dbp.get_object(psp)
         print('**** obj:', r, r.id, r.path, r.pobj)
         ic.Logout()
Example #6
0
def test_urls():
    if ic.Login('admin', '', 'C:/defis/NSI/NSI/'):
        sprav = ic.metadata.NSI.mtd.nsi_sprav.create()
        try:
            print(sprav)
        except:
            print('Error!')

    ic.Logout()
Example #7
0
def test():
    """
    Тестовая функция.
    """
    ok_login = ic.Login(None, None, 'c:/defis/NSI/NSI', True)
    print('START SpravTreeDataSource TEST ... Login:'******'Sprav', 'Regions', None, 'nsi_sprav.mtd', 'NSI'),)
        data_src = icSpravTreeDataSource(sprav_psp)
        print('CHILDREN:', data_src.getChildren())
        
        ic.Logout()        
        print('STOP SpravTreeDataSource TEST ... OK')
Example #8
0
def get_test_catalog():
    """ """
    from ic.db import iccatalog, icdbcatalog
    from ic.db.resources import iccatalogtable
    prj_dir = '../test/testprj/testprj/'
    cat = None
    try:
        ic.Login('user', None, prj_dir)
        src = (('SQLiteDB', 'testsrc', None, 'testsrc.src', 'testprj'), )
        cat = icdbcatalog.icDBCatalog(src)
    finally:
        ic.Logout()

    return cat
Example #9
0
def over_test():
    """ Тестовая функция граничных значений."""
    import ic
    ok_login = ic.Login('test_user', '', 'c:/defis/NSI/NSI', True)
    print('START SpravTreeComboCtrl TEST ... Login:'******'Sprav', 'OrganPrinyat', None, 'nsi_sprav.mtd', 'NSI'), )
        frame = wx.Frame(None)

        tree_combo_ctrl = icSpravTreeComboCtrlPrototype(sprav_psp,
                                                        None,
                                                        True,
                                                        parent=frame,
                                                        size=wx.Size(200, -1))
        button = wx.Button(frame, pos=wx.Point(10, 100))
        print('SELECTED CODE:', tree_combo_ctrl.getSelectedCode())

        frame.Show()
        ic.getKernel().MainLoop()
        ic.Logout()
        print('STOP SpravTreeComboCtrl TEST ... OK')
Example #10
0
def test():
    """
    Функция тестиорвания.
    """
    from ic.components.user import ic_postgres_wrp as src
    prj_dir = 'C:/defis/Registr/Registr'
    res = {'admin': {'activate': 1, 'obj_module': None, 'runner': u"['work_runner']",
                     'legacy': None, 'on_login': u'', 'run_res': u"['work_runner.mnu']",
                     'style': 0, 'group': None, 'component_module': None, 'on_logout': None,
                     'access': [],
                     'menubars': [(('MenuBar', 'test_work_menu', None, 'test_work_menu.mnu', 'work_flow'),)],
                     'local_dir': None, 'type': u'User', 'res_module': None, 'description': None,
                     '_uuid': '551d580195e320ef56350e94f0542250', 'password': u'd41d8cd98f00b204e9800998ecf8427e',
                     'lock_time': ([], [], [], [], [], [], []), 'name': u'admin',
                     'roles': ['administrators'], 'alias': None, 'init_expr': None,
                     'main_win': (('MainWindow', 'work_main_win', None, 'work_main_win.win', 'work_flow'),)},
           u'tester': {'activate': 1, 'obj_module': None, 'on_login': None, 'style': 0, 'group': None,
                       'on_logout': None, 'menubars': [], 'local_dir': u'./#WRK', 'type': 'User',
                       'res_module': None, 'description': None, '_uuid': 'd900ff7aee13ed8f9c55b6e82d26b86f',
                       'component_module': None, 'password': u'd41d8cd98f00b204e9800998ecf8427e',
                       'lock_time': [[], [], [], [], [], [], []], 'name': u'tester', 'roles': [],
                       'alias': None, 'init_expr': None, 'main_win': None}}

    app = wx.PySimpleApp()
    form = wx.Frame(None)

    if ic.Login('test', '', prj_dir):
        try:
            print(ic.resource_loader.dbstore)
            ic.resource_loader.save_res('c:\\defis\\Registr/Registr/users1.acc', res)
            res1 = ic.resource_loader.load_res('D:\\defis\Registr\\Registr/users1.acc')
            user_mngr = icUserManager()
            user_mngr.Edit(form, False)

            form.Show()
        except :
            io_prnt.outErr()
        finally:
            ic.Logout()
    app.MainLoop()
Example #11
0
    def test_db_catalog(self):
        """ Тестируем каталог, хранящийся в реляционной базе."""
        #prj_dir = '../testprj/testprj/'
        print('- prj_dir = ', prj_dir)
        if ic.Login('user', None, prj_dir):
            from ic.db.resources import iccatalogtable
            from sqlalchemy.sql import select

            src = (('SQLiteDB', 'testsrc', None, 'testsrc.src', 'testprj'), )
            tab = iccatalogtable.CatalogTable(None, src).getObject()
            cat = icdbcatalog.icDBCatalog(src)
            if not 'path' in cat.keys():
                #print '***** keys=', cat.keys()
                cat.add(
                    'path',
                    (('Document', 'doc1', None, 'doc1.mtd', 'workflow'), '1'),
                    'Folder', 'title', 'description')

            cat.ctg_refresh()
            #print '***** keys=', cat.keys()
            self.failUnlessEqual('path' in cat.keys(), True)
            item = cat['path']
            self.failUnlessEqual(item.pobj.type, 'Document')
            self.failUnlessEqual(item.pobj.name, 'doc1')
            self.failUnlessEqual(item.pobj.interface, None)
            self.failUnlessEqual(item.pobj.mod, 'doc1.mtd')
            self.failUnlessEqual(item.pobj.subsys, 'workflow')
            self.failUnlessEqual(item.pobj.id, '1')
            self.failUnlessEqual(item.pobj.uuid, None)

            # Проверяем удаление
            cat.remove('path')
            self.failUnlessEqual('path' in cat.keys(), False)
            cat.ctg_refresh()
            self.failUnlessEqual('path' in cat.keys(), False)
            ic.Logout()