def tearDownClass(cls):
     accounts = Accounts()
     current_uid = cls.session_manager.getCurrentUid()
     user_obj_path = accounts.FindUserById(current_uid)
     loginuser = User(user_obj_path)
     loginuser.SetPassword(cls.oldpw)
     do_polkit_agent(cls.newpw)
     cls.dcc.hideDcc()
    def testAccountsModifyUserIcon(self):
        accounts = Accounts()
        current_uid = self.session_manager.getCurrentUid()
        user_obj_path = accounts.FindUserById(current_uid)

        loginuser = User(user_obj_path)
        self.assertTrue(current_uid == loginuser.getUid())

        self.currentUserName = loginuser.getUserName()
        self.currentIcon = loginuser.getIconFile()
        self.assertTrue(self.currentIcon != None)

        while self.randUserIcon == None or \
              self.randUserIcon == self.currentIcon:
            self.randUserIcon = accounts.RandUserIcon()

        ret = self.dcc.showModule("accounts")
        self.assertTrue(ret)

        IndexAvatarWidget = self.dcc.dccObj.child(
            self.randUserIcon,
            roleName='label',
            description=self.dcc.string_Icon)
        self.assertFalse(IndexAvatarWidget)

        curUserNameWidget = self.dcc.dccObj.child(self.currentUserName,
                                                  roleName='label')
        self.assertTrue(curUserNameWidget != None)
        curUserNameWidget.click()

        ModifyAvatarWidget = self.dcc.dccObj.child(
            self.dcc.string_Modify_Avatar, roleName='label')
        self.assertTrue(ModifyAvatarWidget != None)
        ModifyAvatarWidget.click()
        randUserIconWidget = self.dcc.dccObj.child(self.randUserIcon)
        self.assertTrue(randUserIconWidget != None)
        randUserIconWidget.click()

        time.sleep(1)
        self.assertTrue(loginuser.getIconFile() == self.randUserIcon)
        self.assertTrue(self.randUserIcon != self.currentIcon)

        IndexAvatarWidget = self.dcc.dccObj.child(
            self.randUserIcon,
            roleName='label',
            description=self.dcc.string_Icon)
        self.assertTrue(IndexAvatarWidget)

        path = '/var/lib/AccountsService/users/' + self.currentUserName
        user_cfg = configparser.ConfigParser()
        user_cfg.read(path)
        usericon = user_cfg.get('User', 'Icon')
        self.assertTrue(usericon, self.randUserIcon)
    def testAccountsModifyUserPasswordAccept(self):
        accounts = Accounts()
        current_uid = self.session_manager.getCurrentUid()
        user_obj_path = accounts.FindUserById(current_uid)

        loginuser = User(user_obj_path)
        self.assertTrue(current_uid == loginuser.getUid())

        self.currentUserName = loginuser.getUserName()
        self.assertTrue(self.currentUserName != None)

        ret = self.dcc.showModule("accounts")
        self.assertTrue(ret)

        curUserNameWidget = self.dcc.dccObj.child(self.currentUserName,
                                                  roleName='label')
        self.assertTrue(curUserNameWidget != None)
        curUserNameWidget.click()

        ModifyPasswordWidget = self.dcc.dccObj.child(
            self.dcc.string_Modify_Password, roleName='label')
        self.assertTrue(ModifyPasswordWidget != None)
        ModifyPasswordWidget.click()

        NewPasswordWidget = self.dcc.dccObj.child(self.dcc.string_New_Password,
                                                  roleName='password text')
        self.assertTrue(NewPasswordWidget != None)
        NewPasswordWidget.click()
        utils.keyTypeString(self.newpw)

        RepeatPasswordWidget = self.dcc.dccObj.child(
            self.dcc.string_Repeat_Password, roleName='password text')
        self.assertTrue(RepeatPasswordWidget != None)
        RepeatPasswordWidget.click()
        utils.keyTypeString(self.newpw)

        ModifyAcceptWidget = self.dcc.dccObj.child(
            self.dcc.string_Modify_Accept)
        self.assertTrue(ModifyAcceptWidget != None)
        ModifyAcceptWidget.click()

        do_polkit_agent()

        ret = self.dbus_lock.UnlockCheck(self.currentUserName, self.newpw)
        self.assertTrue(ret)
        ret = self.dbus_lock.UnlockCheck(self.currentUserName, self.oldpw)
        self.assertFalse(ret)
Esempio n. 4
0
    def testAccountsDefaultIcon(self):
        accounts = Accounts()
        current_uid = self.session_manager.getCurrentUid()
        user_obj_path = accounts.FindUserById(current_uid)

        loginuser = User(user_obj_path)
        self.assertTrue(current_uid == loginuser.getUid())

        ret =  self.dcc.showDcc()
        self.assertTrue(ret)

        defaulticon = loginuser.getIconFile()
        iconwidget = self.dcc.dccObj.child(defaulticon,
                description="iconMainWidget")
        self.assertTrue(iconwidget != None)

        ret = self.dcc.hideDcc()
        self.assertTrue(ret)
Esempio n. 5
0
 def setUpClass(cls):
     cls.session_manager = SessionManager()
     cls.dcc = dde_control_center.Dde_control_center()
     cls.accounts = Accounts()