Beispiel #1
0
    def test_sql_server_dsn_one_table_columns(self):
        """Tests ODBC table columns"""

        lst_instances = _client_object_instances_from_script(
            "sources_types/odbc/table/odbc_table_columns.py",
            "odbc/table",
            Dsn=self._connection_string,
            Table="all_views")

        # !!!
        str_instances_set = set([str(one_inst) for one_inst in lst_instances])
        print("str_instances_set=", str_instances_set)

        # Checks the presence of some Python dependencies, true for all Python versions and OS platforms.
        for one_str in [
                # check a couple of columns.
                lib_uris.PathFactory().odbc.column(Dsn=self._connection_string,
                                                   Table='all_views',
                                                   Column='type_desc'),
                lib_uris.PathFactory().odbc.column(Dsn=self._connection_string,
                                                   Table='all_views',
                                                   Column='parent_object_id'),
                lib_uris.PathFactory().odbc.table(Dsn=self._connection_string,
                                                  Table='all_views'),
        ]:
            self.assertTrue(one_str in str_instances_set)
Beispiel #2
0
    def test_oracle_sqldatasources(self):
        """Tests ODBC data sources"""

        lst_instances = _client_object_instances_from_script(
            "sources_types/Databases/win32_sqldatasources_pyodbc.py")

        str_instances_set = set([str(one_inst) for one_inst in lst_instances])

        # At least these instances must be present, especially the Oracle DSN used for these tests.
        for one_str in [
                lib_uris.PathFactory().CIM_ComputerSystem(Name=CurrentMachine),
                lib_uris.PathFactory().odbc.dsn(Dsn=self.oracle_dsn),
        ]:
            self.assertTrue(one_str in str_instances_set)
Beispiel #3
0
    def test_sql_server_sqldatasources(self):
        """Tests ODBC data sources"""

        lst_instances = _client_object_instances_from_script(
            "sources_types/Databases/win32_sqldatasources_pyodbc.py")

        str_instances_set = set([str(one_inst) for one_inst in lst_instances])
        print("str_instances_set=", str_instances_set)

        # At least these instances must be present.
        for one_str in [
                lib_uris.PathFactory().CIM_ComputerSystem(Name=CurrentMachine),
                lib_uris.PathFactory().odbc.dsn(Dsn=self._connection_string),
        ]:
            print("one_str=", one_str)
            self.assertTrue(one_str in str_instances_set)
Beispiel #4
0
    def test_all_sqldatasources(self):
        """Tests ODBC data sources"""

        lst_instances = _client_object_instances_from_script(
            "sources_types/Databases/win32_sqldatasources_pyodbc.py")

        str_instances_set = set([str(one_inst) for one_inst in lst_instances])
        print("Instances")
        for one_instance in sorted(str_instances_set):
            print("    one_instance=", one_instance)

        # At least these instances must be present. Other are possible such as "DSN=dBASE Files"
        for one_str in [
                lib_uris.PathFactory().CIM_ComputerSystem(Name=CurrentMachine),
                lib_uris.PathFactory().odbc.dsn(Dsn="DSN=Excel Files"),
        ]:
            print("one_str=", one_str)
            self.assertTrue(one_str in str_instances_set)
Beispiel #5
0
 def test_connection_string_encoding(self):
     """
     This checks that all connection strings can be correctly encoded on a URL.
     """
     for one_connect_str in connection_strings_light + connection_strings_heavy:
         connect_str_entity_id = lib_uris.PathFactory().odbc.dsn(
             Dsn=one_connect_str)
         class_name, entity_id_dict = lib_util.SplitPath(
             connect_str_entity_id)
         actual_dsn = entity_id_dict["Dsn"]
         self.assertEqual(class_name, "odbc/dsn")
         self.assertEqual(one_connect_str, actual_dsn)
Beispiel #6
0
    def test_oracle_dsn_one_table_columns(self):
        """Tests ODBC table columns"""

        lst_instances = _client_object_instances_from_script(
            "sources_types/odbc/table/odbc_table_columns.py",
            "odbc/table",
            Dsn=self.oracle_dsn,
            Table="dm_os_windows_info")

        str_instances_set = set([str(one_inst) for one_inst in lst_instances])

        print("Instances")
        for one_instance in sorted(str_instances_set):
            print("    one_instance=", one_instance)

        # Checks the presence of some Python dependencies, true for all Python versions and OS platforms.
        for one_str in [
                lib_uris.PathFactory().odbc.column(
                    Dsn=self.oracle_dsn,
                    Table='dm_os_windows_info',
                    Column='windows_service_pack_level'),
                lib_uris.PathFactory().odbc.column(
                    Dsn=self.oracle_dsn,
                    Table='dm_os_windows_info',
                    Column='os_language_version'),
                lib_uris.PathFactory().odbc.column(Dsn=self.oracle_dsn,
                                                   Table='dm_os_windows_info',
                                                   Column='windows_release'),
                lib_uris.PathFactory().odbc.column(Dsn=self.oracle_dsn,
                                                   Table='dm_os_windows_info',
                                                   Column='windows_sku'),
                lib_uris.PathFactory().odbc.table(Dsn=self.oracle_dsn,
                                                  Table='dm_os_windows_info'),
        ]:
            print("one_str=", one_str)
            self.assertTrue(one_str in str_instances_set)
Beispiel #7
0
    def test_oracle_dsn_tables(self):
        """Tests ODBC data sources"""

        lst_instances = _client_object_instances_from_script(
            "sources_types/odbc/dsn/odbc_dsn_tables.py",
            "odbc/dsn",
            Dsn=self.oracle_dsn)

        str_instances_set = set([str(one_inst) for one_inst in lst_instances])

        # Checks the presence of some Python dependencies, true for all Python versions and OS platforms.
        for one_str in [
                lib_uris.PathFactory().odbc.table(Dsn=self.oracle_dsn,
                                                  Table='all_columns'),
                lib_uris.PathFactory().odbc.table(Dsn=self.oracle_dsn,
                                                  Table='assembly_files'),
                lib_uris.PathFactory().odbc.table(
                    Dsn=self.oracle_dsn, Table='change_tracking_tables'),
                lib_uris.PathFactory().odbc.table(
                    Dsn=self.oracle_dsn, Table='dm_broker_queue_monitors'),
                lib_uris.PathFactory().odbc.table(
                    Dsn=self.oracle_dsn,
                    Table='dm_hadr_availability_group_states'),
                lib_uris.PathFactory().odbc.table(
                    Dsn=self.oracle_dsn,
                    Table='dm_hadr_database_replica_cluster_states'),
                lib_uris.PathFactory().odbc.table(
                    Dsn=self.oracle_dsn, Table='dm_hadr_instance_node_map'),
                lib_uris.PathFactory().odbc.table(
                    Dsn=self.oracle_dsn, Table='server_audit_specifications'),
                lib_uris.PathFactory().odbc.table(Dsn=self.oracle_dsn,
                                                  Table='server_audits'),
                lib_uris.PathFactory().odbc.table(Dsn=self.oracle_dsn,
                                                  Table='sysusers'),
        ]:
            self.assertTrue(one_str in str_instances_set)
Beispiel #8
0
    def test_sql_server_dsn_tables(self):
        """Tests ODBC data sources"""

        lst_instances = _client_object_instances_from_script(
            "sources_types/odbc/dsn/odbc_dsn_tables.py",
            "odbc/dsn",
            Dsn=self._connection_string)

        str_instances_set = set([str(one_inst) for one_inst in lst_instances])

        # Checks the presence of some Python dependencies, true for all Python versions and OS platforms.
        for one_str in [
                lib_uris.PathFactory().odbc.table(Dsn=self._connection_string,
                                                  Table='all_views'),
        ]:
            self.assertTrue(one_str in str_instances_set)
Beispiel #9
0
RemoteRdf4TestServerPort = 8014
RemoteMimeTestServerPort = 8020

# This is used for test of Survol wsgiserver based on wsgiref
RemoteWsgi1TestServerPort = 8500
RemoteWsgi2TestServerPort = 8501

# Beware of supervisord.conf and port=localhost:9001

# This is used for testing Twisted WSGI server.
RemoteTwistedWsgi1TestServerPort = 9100

# Several Survol scripts return this executable among their results, so it can be tested.
CurrentExecutable = lib_util.standardized_file_path(sys.executable)

CurrentExecutablePath = lib_uris.PathFactory().CIM_DataFile(
    Name=CurrentExecutable)


def __dump_server_content(log_filename):
    """This is called at the end of the execution of a Survol agent created here for tests.
    It displays the content of a log file created by this agent."""
    try:
        agent_stream = open(log_filename)
        log_lines = agent_stream.readlines()

        # Maybe nothing special happened so it is not worth printing the content.
        if len(log_lines) == 2 \
                and log_lines[0].startswith(r"survol\scripts\cgiserver.py") \
                and log_lines[1].startswith(r"survol\scripts\cgiserver.py startup"):
            return
        logging.debug("Agent log file: %s" % log_filename)