Exemple #1
0
    def test_ModifUserGroup(self):
        '''
        测试 修改用户组信息
        :return:
        '''

        ugn = '测试1'
        pms = UserGroup.getAllPms()
        UserGroup.createNewUserGroup(ugn, pms)

        User.createRoot()

        ''' 渲染 '''
        settings.debug_username = User.rootAccount
        user = User.obj(username=settings.debug_username)
        data = {
            'oname': '测试1',
            'name': '原测试1',
        }

        for pmn in UserGroup.getPmNames():
            if random.randint(0, 1):
                data[pmn] = 'on'

        v = Views(user)
        v.html(self.appM.request(localpart=ModifUserGroup.URL, data=data, method='POST').data)
Exemple #2
0
 def test_render_manage_user_option(self):
     '''
     渲染 管理用户选项
     :return:
     '''
     User.createRoot()
     user = User.obj(username=User.rootAccount)
     v = Views(user)
Exemple #3
0
 def test_render_manage_user(self):
     '''
     渲染 manage_user页面
     :return:
     '''
     User.createRoot()
     user = User.obj(username=User.rootAccount)
     views = Views(user)
     views.render_manage_user()
     views.html('manage_user')
Exemple #4
0
    def test_ManageUser(self):
        '''
        :return:
        '''

        User.createRoot()
        ''' 渲染 '''
        settings.debug_username = User.rootAccount
        user = User.obj(username=settings.debug_username)

        v = Views(user)
        v.html(self.appM.request(localpart=ManageUser.URL, method='GET').data)
Exemple #5
0
    def test_render_sim_terminal_page(self):
        '''
        测试 修改用户信息界面
        :return:
        '''
        user = User.obj(username=User.rootAccount)
        if not user:
            User.createRoot()
            user = User.obj(username=User.rootAccount)

        views = Views(user)
        views.render_sim_terminal_page(SimTermLocalServer)
        views.html('sim_terminal_page')
Exemple #6
0
    def test_render_modif_user(self):
        '''
        测试 修改用户信息界面
        :return:
        '''
        user = User.obj(username=User.rootAccount)
        if not user:
            User.createRoot()
            user = User.obj(username=User.rootAccount)

        views = Views(user)
        views.render_modif_user(user, ModifUserN, ModifUserPW, AddUG, RemoveUG)
        views.html('modif_user')
Exemple #7
0
    def test_render_create_user_group(self):
        '''
        渲染 用户组信息列表
        :return:
        '''
        User.createRoot()
        user = User.obj(username=User.rootAccount)
        ugn = '测试1'
        pms = UserGroup.getAllPms()
        UserGroup.createNewUserGroup(ugn, pms)

        views = Views(user)
        views.render_create_user_group(CreateUserGroup)
        views.html('create_user_group')
Exemple #8
0
    def test_CreateUserGroup(self):
        '''
        测试 创建用户组
        :return:
        '''

        settings.debug_username = User.rootAccount

        user = User.obj(username=settings.debug_username)
        if not user:
            User.createRoot()
            user = User.obj(username=settings.debug_username)

        v = Views(user)
        v.html(self.appM.request(ManageUser.url).data)
Exemple #9
0
    def test_SimTermLocalServer_GET(self):
        """
        测试 打开本地服务交互终端
        :return:
        """

        user = User.obj(username=User.rootAccount)
        if not user:
            User.createRoot()

        settings.debug_user = user
        ''' 渲染 '''
        v = Views(user)
        v.html(
            self.appM.request(localpart=SimTermLocalServer.URL,
                              method='GET').data)
Exemple #10
0
    def test_render_create_user(self):
        '''
        测试 渲染 创建用户 界面
        :return:
        '''

        self.redis.flushdb()
        User.createRoot()
        user = User.obj(username=User.rootAccount)

        ugn = '测试1'
        pms = UserGroup.getAllPms()
        UserGroup.createNewUserGroup(ugn, pms)

        views = Views(user)
        views.render_create_user(CreateUser)
        views.html('create_user')
Exemple #11
0
    def test_SimTermLocalServer_POST(self):
        """
        测试 打开本地服务交互终端
        :return:
        """

        user = User.obj(username=User.rootAccount)
        if not user:
            User.createRoot()

        settings.debug_user = user
        data = {SimTermLocalServer.python_code: "a = u'aaa'\nprint a"}
        ''' 渲染 '''
        v = Views(user)
        v.html(
            self.appM.request(localpart=SimTermLocalServer.URL,
                              data=data,
                              method='POST').data)
Exemple #12
0
    def test_render_termial_output(self):
        """
        :return:
        """
        term_server = TerminalServer()
        term_server.term_title = '测试终端输出用'
        term_server.term_output = '测试终端输出的内容'

        term_output = [term_server, term_server]

        user = User.obj(username=User.rootAccount)
        if not user:
            User.createRoot()
            user = User.obj(username=User.rootAccount)

        views = Views(user)
        views.render_terminal_output(term_output)
        views.html('terminal_output')
Exemple #13
0
    def test_render_user_list(self):
        '''
        渲染 用户列表
        :return:
        '''
        # self.redis.flushdb()

        user = User.obj(username=User.rootAccount)
        if not user:
            User.createRoot()
            user = User.obj(username=User.rootAccount)

        un = 'test1'
        pw = '123456'
        User.createNewUser(un, pw)

        views = Views(user)
        views.render_user_list(ModifUser)
        views.html('user_list')
Exemple #14
0
    def test_render_sim_term_local_server(self):
        """
        :return:
        """
        term_server = TerminalServer()
        term_server.term_title = '本地服务进程'
        term_server.term_output = '测试终端输出的内容'

        term_output = [term_server, term_server]

        user = User.obj(username=User.rootAccount)
        if not user:
            User.createRoot()
            user = User.obj(username=User.rootAccount)

        views = Views(user)
        views.render_terminal_output(term_output)
        views.render_terminal_input()

        views.render_sim_term_local_server(SimTermLocalServer)
        views.html('sim_term_local_server')
Exemple #15
0
    def test_creatRoot(self):
        '''
        创建root用户
        :return:
        '''
        self.redis.flushdb()

        root = User.createRoot()
        print 'root name ->', root.username
        rootUg = root.getUserGroupByName(User.rootAccount)

        print rootUg.pms
        print root.userGroups

        root.save()

        root = User.obj(username=User.rootAccount)
        rootUg = root.getUserGroupByName(UserGroup.rootGroup)

        print rootUg.pms
        print root.userGroups