Esempio n. 1
0
    def test_concurentedit(self):
        user1 = add_user("user1")
        user1.is_superuser = True
        user1.save()
        grp = LucteriosGroup.objects.create(
            name="mygroup")
        grp.save()

        self.call(
            '/CORE/authentification', {'username': '******', 'password': '******'})
        self.assert_observer('core.auth', 'CORE', 'authentification')
        self.assert_xml_equal('', 'OK')

        self.call('/CORE/groupsEdit', {'group': '1'})
        self.assert_observer('core.custom', 'CORE', 'groupsEdit')
        self.assert_count_equal('CLOSE_ACTION/ACTION', 1)
        self.assert_action_equal(
            'CLOSE_ACTION/ACTION', ('unlock', None, "CORE", "unlock", 1, 1, 1))
        self.assert_count_equal('CONTEXT/PARAM', 2)
        self.assert_xml_equal('CONTEXT/PARAM[@name="group"]', '1')
        self.assert_xml_equal(
            'CONTEXT/PARAM[@name="LOCK_IDENT"]', 'lucterios.CORE.models-LucteriosGroup-1')

        new_test = LucteriosTest("setUp")
        new_test.setUp()
        new_test.call(
            '/CORE/authentification', {'username': '******', 'password': '******'})
        new_test.assert_observer('core.auth', 'CORE', 'authentification')
        new_test.assert_xml_equal('', 'OK')

        new_test.call('/CORE/groupsEdit', {'group': '1'})
        new_test.assert_observer('core.exception', 'CORE', 'groupsEdit')
        new_test.assert_xml_equal(
            'EXCEPTION/MESSAGE', six.text_type("Enregistrement verrouillé par 'admin'!"))
        new_test.assert_xml_equal('EXCEPTION/CODE', '3')

        self.call('/CORE/exitConnection', {})

        new_test.call('/CORE/groupsEdit', {'group': '1'})
        new_test.assert_observer('core.custom', 'CORE', 'groupsEdit')
Esempio n. 2
0
    def test_concurentedit(self):
        user1 = add_user("user1")
        user1.is_superuser = True
        user1.save()

        self.call(
            '/CORE/authentification', {'username': '******', 'password': '******'})
        self.assert_observer('core.auth', 'CORE', 'authentification')
        self.assert_xml_equal('', 'OK')

        self.call('/CORE/usersEdit', {'user_actif': '3'})
        self.assert_observer('core.custom', 'CORE', 'usersEdit')
        self.assert_count_equal('CLOSE_ACTION/ACTION', 1)
        self.assert_action_equal(
            'CLOSE_ACTION/ACTION', ('unlock', None, "CORE", "unlock", 1, 1, 1))
        self.assert_count_equal('CONTEXT/PARAM', 2)
        self.assert_xml_equal('CONTEXT/PARAM[@name="user_actif"]', '3')
        self.assert_xml_equal(
            'CONTEXT/PARAM[@name="LOCK_IDENT"]', 'lucterios.CORE.models-LucteriosUser-3')

        new_test = LucteriosTest("setUp")
        new_test.setUp()
        new_test.call(
            '/CORE/authentification', {'username': '******', 'password': '******'})
        new_test.assert_observer('core.auth', 'CORE', 'authentification')
        new_test.assert_xml_equal('', 'OK')

        new_test.call('/CORE/usersEdit', {'user_actif': '3'})
        new_test.assert_observer('core.exception', 'CORE', 'usersEdit')
        new_test.assert_xml_equal(
            'EXCEPTION/MESSAGE', six.text_type("Enregistrement verrouillé par 'admin'!"))
        new_test.assert_xml_equal('EXCEPTION/CODE', '3')

        self.call(
            '/CORE/unlock', {'user_actif': '3', "LOCK_IDENT": 'lucterios.CORE.models-LucteriosUser-3'})
        self.assert_observer('core.acknowledge', 'CORE', 'unlock')

        new_test.call('/CORE/usersEdit', {'user_actif': '3'})
        new_test.assert_observer('core.custom', 'CORE', 'usersEdit')