예제 #1
0
    def test_02_db_caconnector(self):
        pass
        # save a CA connector
        ca_id = save_caconnector({
            "caconnector": "myCA",
            "type": "local",
            "cakey": "/opt/ca/key.pem",
            "cacert": "/opt/ca/cert.pem"
        })
        self.assertTrue(ca_id > 0, ca_id)
        # Update the CA connector
        save_caconnector({
            "caconnector": "myCA",
            "type": "local",
            "WorkingDir": "/opt/ca",
            "Password": "******",
            "type.Password": "******"
        })
        # check if connector is in DB
        calist = get_caconnector_list()
        self.assertEqual(len(calist), 1)
        calist = get_caconnector_list(filter_caconnector_type="local")
        self.assertEqual(len(calist), 1)
        # check the config values of "myCA"
        self.assertEqual(calist[0].get("data").get("WorkingDir"), "/opt/ca")
        self.assertEqual(calist[0].get("data").get("cakey"), "/opt/ca/key.pem")

        # get the CA connector list without a config
        calist = get_caconnector_list(return_config=False)
        self.assertEqual(len(calist), 1)
        # check that there are no values
        self.assertEqual(calist[0].get("data"), {})

        # test the CA connector:
        config = get_caconnector_config("myCA")
        self.assertEqual(config.get("WorkingDir"), "/opt/ca")
        self.assertEqual(config.get("cakey"), "/opt/ca/key.pem")
        # get_caconnector_object()
        ca_obj = get_caconnector_object("myCA")
        self.assertTrue(ca_obj.connector_type, "local")
        catype = get_caconnector_type("myCA")
        self.assertTrue(catype, "local")

        # delete the CA connector
        delete_caconnector("myCA")

        # check if connector is deleted from DB
        self.assertEqual(len(calist), 1)
예제 #2
0
def delete_caconnector_api(name=None):
    """
    returns a json list of the available applications
    """
    g.audit_object.log({"detail": u"{0!s}".format(name)})
    res = delete_caconnector(name)
    g.audit_object.log({"success": True})
    return send_result(res)
예제 #3
0
def delete_caconnector_api(name=None):
    """
    returns a json list of the available applications
    """
    g.audit_object.log({"detail": "{0!s}".format(name)})
    res = delete_caconnector(name)
    g.audit_object.log({"success": True})
    return send_result(res)
예제 #4
0
def delete_caconnector_api(name=None):
    """
    Delete a specific CA connector
    """
    g.audit_object.log({"detail": u"{0!s}".format(name)})
    res = delete_caconnector(name)
    g.audit_object.log({"success": True})
    return send_result(res)
    def test_02_db_caconnector(self):
        pass
        # save a CA connector
        ca_id = save_caconnector({"caconnector": "myCA",
                                  "type": "local",
                                  "cakey": "/opt/ca/key.pem",
                                  "cacert": "/opt/ca/cert.pem"})
        self.assertTrue(ca_id > 0, ca_id)
        # Update the CA connector
        save_caconnector({"caconnector": "myCA",
                          "type": "local",
                          "WorkingDir": "/opt/ca",
                          "Password": "******",
                          "type.Password": "******"})
        # check if connector is in DB
        calist = get_caconnector_list()
        self.assertEqual(len(calist), 1)
        calist = get_caconnector_list(filter_caconnector_type="local")
        self.assertEqual(len(calist), 1)
        # check the config values of "myCA"
        self.assertEqual(calist[0].get("data").get("WorkingDir"), "/opt/ca")
        self.assertEqual(calist[0].get("data").get("cakey"), "/opt/ca/key.pem")

        # get the CA connector list without a config
        calist = get_caconnector_list(return_config=False)
        self.assertEqual(len(calist), 1)
        # check that there are no values
        self.assertEqual(calist[0].get("data"), {})

        # test the CA connector:
        config = get_caconnector_config("myCA")
        self.assertEqual(config.get("WorkingDir"), "/opt/ca")
        self.assertEqual(config.get("cakey"), "/opt/ca/key.pem")
        # get_caconnector_object()
        ca_obj = get_caconnector_object("myCA")
        self.assertTrue(ca_obj.connector_type, "local")
        catype = get_caconnector_type("myCA")
        self.assertTrue(catype, "local")

        # delete the CA connector
        delete_caconnector("myCA")

        # check if connector is deleted from DB
        self.assertEqual(len(calist), 1)