Exemple #1
0
    def test_extra(self):
        self.assertEqual([], self.luct_glo.listing())

        inst = LucteriosInstance("inst_e", self.path_dir)
        inst.set_extra(
            "DEBUG=True,ALLOWED_HOSTS=[localhost;127.0.0.1],DEFAULT_PAGE=cms/,NBMAX=5,PIVALUE=3.1415"
        )
        inst.add()
        self.assertEqual(["inst_e"], self.luct_glo.listing())

        # print(open(self.path_dir + '/inst_a/settings.py', 'r').readlines())

        inst = LucteriosInstance("inst_e", self.path_dir)
        inst.read()
        self.assertEqual(
            {
                'DEBUG': True,
                '': {
                    'mode': (0, 'Connexion toujours nécessaire')
                },
                'ALLOWED_HOSTS': ['localhost', '127.0.0.1'],
                'DEFAULT_PAGE': 'cms/',
                "NBMAX": 5,
                'PIVALUE': 3.1415
            }, inst.extra)
        inst.modif()

        inst = LucteriosInstance("inst_e", self.path_dir)
        inst.read()
Exemple #2
0
 def add_modif_inst_result(self, result, to_create):
     inst = LucteriosInstance(result[0])
     inst.set_extra("LANGUAGE_CODE='%s'" % result[5])
     inst.set_appli(result[1])
     inst.set_module(result[2])
     inst.set_database(result[4])
     if to_create:
         inst.add()
     else:
         inst.modif()
     inst = LucteriosInstance(result[0])
     inst.set_extra(result[3])
     inst.security()
     self.refresh(result[0])
Exemple #3
0
 def add_modif_inst_result(self, result, to_create):
     inst = LucteriosInstance(result[0])
     inst.set_extra("LANGUAGE_CODE=%s" % result[5])
     inst.set_appli(result[1])
     inst.set_module(result[2])
     inst.set_database(result[4])
     if to_create:
         inst.add()
     else:
         inst.modif()
     inst = LucteriosInstance(result[0])
     inst.set_extra(result[3])
     inst.security()
     self.refresh(result[0])
Exemple #4
0
    def test_extra(self):
        self.assertEqual([], self.luct_glo.listing())

        inst = LucteriosInstance("inst_e", self.path_dir)
        inst.set_extra("DEBUG=True,ALLOWED_HOSTS=[localhost]")
        inst.add()
        self.assertEqual(["inst_e"], self.luct_glo.listing())

        # print(open(self.path_dir + '/inst_a/settings.py', 'r').readlines())

        inst = LucteriosInstance("inst_e", self.path_dir)
        inst.read()
        self.assertEqual({'DEBUG': True, '': {'mode': (
            0, 'Connexion toujours nécessaire')}, 'ALLOWED_HOSTS': ['localhost']}, inst.extra)
Exemple #5
0
    def test_extra(self):
        self.assertEqual([], self.luct_glo.listing())

        inst = LucteriosInstance("inst_e", self.path_dir)
        inst.set_extra("DEBUG=True,ALLOWED_HOSTS=[localhost;127.0.0.1],DEFAULT_PAGE=cms/,NBMAX=5,PIVALUE=3.1415")
        inst.add()
        self.assertEqual(["inst_e"], self.luct_glo.listing())

        # print(open(self.path_dir + '/inst_a/settings.py', 'r').readlines())

        inst = LucteriosInstance("inst_e", self.path_dir)
        inst.read()
        self.assertEqual({'DEBUG': True, '': {'mode': (0, 'Connexion toujours nécessaire')},
                          'ALLOWED_HOSTS': ['localhost', '127.0.0.1'], 'DEFAULT_PAGE': 'cms/',
                          "NBMAX": 5, 'PIVALUE': 3.1415}, inst.extra)
        inst.modif()

        inst = LucteriosInstance("inst_e", self.path_dir)
        inst.read()
Exemple #6
0
    def test_security(self):
        from django.contrib.auth import authenticate
        self.assertEqual([], self.luct_glo.listing())

        inst = LucteriosInstance("inst_g", self.path_dir)
        inst.add()
        self.assertEqual(["inst_g"], self.luct_glo.listing())

        self.assertEqual(
            ["0"],
            list(
                self.run_sqlite_cmd(
                    "inst_g",
                    "SELECT value FROM CORE_parameter WHERE name='CORE-connectmode';"
                )))
        self.assertEqual(
            authenticate(username='******', password='******').username, 'admin')

        inst = LucteriosInstance("inst_g", self.path_dir)
        inst.set_extra("PASSWORD=abc123,MODE=2")
        inst.security()

        self.assertEqual([
            "Admin password change in 'inst_g'.",
            "Security mode change in 'inst_g'."
        ], inst.msg_list)
        self.assertEqual(
            ["2"],
            list(
                self.run_sqlite_cmd(
                    "inst_g",
                    "SELECT value FROM CORE_parameter WHERE name='CORE-connectmode';"
                )))
        self.assertEqual(authenticate(username='******', password='******'),
                         None)
        self.assertEqual(
            authenticate(username='******', password='******').username,
            'admin')

        inst = LucteriosInstance("inst_g", self.path_dir)
        inst.set_extra("MODE=1,PASSWORD=abc,123;ABC=789,3333")
        inst.security()
        self.assertEqual(authenticate(username='******', password='******'),
                         None)
        self.assertEqual(authenticate(username='******', password='******'),
                         None)
        self.assertEqual(
            authenticate(username='******',
                         password='******').username, 'admin')

        inst = LucteriosInstance("inst_g", self.path_dir)
        inst.set_extra("PASSWORD=ppooi=jjhg,fdd,MODE=0")
        inst.security()
        self.assertEqual(
            authenticate(username='******', password='******').username,
            'admin')
Exemple #7
0
    def test_security(self):
        from django.contrib.auth import authenticate
        self.assertEqual([], self.luct_glo.listing())

        inst = LucteriosInstance("inst_g", self.path_dir)
        inst.add()
        self.assertEqual(["inst_g"], self.luct_glo.listing())

        self.assertEqual(["0"], list(self.run_sqlite_cmd(
            "inst_g", "SELECT value FROM CORE_parameter WHERE name='CORE-connectmode';")))
        self.assertEqual(
            authenticate(username='******', password='******').username, 'admin')

        inst = LucteriosInstance("inst_g", self.path_dir)
        inst.set_extra("PASSWORD=abc123,MODE=2")
        inst.security()

        self.assertEqual(["Admin password change in 'inst_g'.",
                          "Security mode change in 'inst_g'."], inst.msg_list)
        self.assertEqual(["2"], list(self.run_sqlite_cmd(
            "inst_g", "SELECT value FROM CORE_parameter WHERE name='CORE-connectmode';")))
        self.assertEqual(
            authenticate(username='******', password='******'), None)
        self.assertEqual(
            authenticate(username='******', password='******').username, 'admin')

        inst = LucteriosInstance("inst_g", self.path_dir)
        inst.set_extra("MODE=1,PASSWORD=abc,123;ABC=789,3333")
        inst.security()
        self.assertEqual(
            authenticate(username='******', password='******'), None)
        self.assertEqual(
            authenticate(username='******', password='******'), None)
        self.assertEqual(authenticate(
            username='******', password='******').username, 'admin')

        inst = LucteriosInstance("inst_g", self.path_dir)
        inst.set_extra("PASSWORD=ppooi=jjhg,fdd,MODE=0")
        inst.security()
        self.assertEqual(
            authenticate(username='******', password='******').username, 'admin')