示例#1
0
    def test_modified(self):
        """ Update base attributes of a BonitaUser """
        user = BonitaUser(username=u'myusername', password=u'mypassword')
        user._uuid = 'myuuid'

        # Prepare response of MockedServer
        url = '/identityAPI/updateUserByUUID'
        code = 200
        user_xml = build_bonita_user_xml(uuid='myuuid', password='******', username='******')
        BonitaServer.set_response_list([[url, code, user_xml]])

        # Modify some base attributes
        user.last_name = u'last_name'
        user.title = u'Doctor'
        user.username = u'other_username'
        user.first_name = u'first_name'
        user.job_title = u'job_title'

        user._update_base_attributes()

        assert user.last_name == u'last_name'
        assert user.title == u'Doctor'
        assert user.username == u'other_username'
        assert user.first_name == u'first_name'
        assert user.job_title == u'job_title'

        dirties = user.get_dirties()
        for attribute in user.BASE_ATTRIBUTES:
            assert attribute not in dirties
示例#2
0
    def test_base_attributes_modified(self):
        """ Update BonitaUser base attributes """
        user = BonitaUser(username=u'myusername', password=u'mypassword')
        user._uuid = 'myuuid'
        user.clear()

        # Prepare response of MockedServer
        url = '/identityAPI/updateUserByUUID'
        code = 200
        user_xml = build_bonita_user_xml(uuid='myuuid', password='******', username='******')
        BonitaServer.set_response_list([[url, code, user_xml]])

        # Modify some base attributes
        user.last_name = u'last_name'
        user.title = u'Doctor'
        user.username = u'other_username'
        user.first_name = u'first_name'
        user.job_title = u'job_title'

        user._update()

        assert user.is_modified is False
        assert user.last_name == u'last_name'
        assert user.title == u'Doctor'
        assert user.username == u'other_username'
        assert user.first_name == u'first_name'
        assert user.job_title == u'job_title'