tests.fake package

Submodules

tests.fake.fake_database_information module

Fake class for the Information for the SQLite Database

class tests.fake.fake_database_information.FakeDatabaseInformation(tables: [], column_type: {<class 'str'>, <class 'type'>})[source]

Bases: object

Fake class representing the SQLite Query validator.

GetTableColumnsAndType(table: str, all_lowercase=False) → [{<class 'str'>, <class 'type'>}][source]

Returns the table information from the database

Parameters:table (str) – the name of the table
Returns:the table information first the column and then the type
Return type:[{str, type}]
GetTablesFromDatabase() → [<class 'str'>][source]

Executes the SQL Query.

Returns:the name of the tables
Return type:[str]

tests.fake.fake_explain_query_plan module

Fake class for the explain query plan.

class tests.fake.fake_explain_query_plan.FakeExplainQueryPlan(is_read_only: bool = True, locked_tables: [] = [])[source]

Bases: plasoscaffolder.dal.base_explain_query_plan.BaseExplainQueryPlan

Fake class representing the explain query plan.

GetLockedTables(query: str) → [<class 'str'>][source]

Determines the table that were locked during the SQL query.

Parameters:query (str) – the sql query to get the locked tables from
Returns:the list of tables
Return type:[str]
IsReadOnly(query: str) → bool[source]

Determines if the query is read only.

Parameters:query (str) – the sql query to determine if it is read only
Returns:true if it is read only, false if it is not
Return type:bool

tests.fake.fake_file_handler module

fake class to create files

class tests.fake.fake_file_handler.FakeFileHandler[source]

Bases: plasoscaffolder.common.base_file_handler.BaseFileHandler

The fake of the file handler.

AddContent(source: str, content: str) → str[source]
CopyFile(source: str, destination: str) → str[source]
CreateFile(directory_path: str, file_name: str, filename_suffix: str)[source]
CreateFileFromPath(file_path: str) → str[source]
classmethod CreateFilePath(path: str, name: str, suffix: str) → str[source]
CreateFolderForFilePathIfNotExist(file_path: str)[source]
CreateOrModifyFileWithContent(source: str, content: str)[source]

tests.fake.fake_mapping_helper module

fake for __helper methods for mapping

class tests.fake.fake_mapping_helper.FakeMappingHelper(template_path: str)[source]

Bases: plasoscaffolder.bll.mappings.base_mapping_helper.BaseMappingHelper

Fake for the mapping helper.

GenerateClassName(plugin_name: str) → str[source]
RenderTemplate(template_filename: str, context: dict) → str[source]

tests.fake.fake_sqlite_database_information module

Base for sql Query validators

class tests.fake.fake_sqlite_database_information.FakeSQLiteDatabaseInformation(required_tables: [<class 'str'>])[source]

Bases: plasoscaffolder.dal.base_database_information.BaseDatabaseInformation

Class representing the fake SQLite Database validator

GetTableColumnsAndType(table: str, all_lowercase=False) → [<class 'str'>][source]

Getting Types for Column if there is are multiple tables

Parameters:
Returns:

the column model with the types,

or None if there was a prefix error and it could not be parsed

Return type:

[sql_query_column_model.SQLColumnModel]

GetTablesFromDatabase() → [<class 'str'>][source]

Executes the SQL Query.

Parameters:query (str) – The SQL Query to execute on the SQLite database.
Returns:the names of the tables
Return type:[str]

tests.fake.fake_sqlite_plugin_helper module

Fake Module containing helper functions for the SQLite plugin

class tests.fake.fake_sqlite_plugin_helper.FakeSQLitePluginHelper(plugin_exists=False, folder_exists=False, file_exists=False, valid_name=True, change_bool_after_every_call_plugin_exists=False, change_bool_after_every_call_folder_exists=False, change_bool_after_every_call_file_exists=False, change_bool_after_every_call_valid_name=False, distinct_columns=None, valid_row_name=True, change_bool_after_every_call_valid_row_name=False, change_bool_after_every_call_valid_comma_separated_string=False, valid_comma_separated_string=True, columns_and_timestamp_column=([], []), assumed_timestamps=[])[source]

Bases: plasoscaffolder.bll.services.base_sqlite_plugin_helper.BaseSQLitePluginHelper

Fake for the SQLite plugin helper

FileExists(path: str) → bool[source]

will return true false true ... starting with the initial (against loops while testing)

FolderExists(path: str) → bool[source]

will return true false true ... starting with the initial (against loops while testing)

GetAssumedTimestamps(columns: [<module 'plasoscaffolder.model.sql_query_column_model' from '/home/docs/checkouts/readthedocs.org/user_builds/plasoscaffolder/checkouts/latest/src/plasoscaffolder/model/sql_query_column_model.py'>]) → [<class 'str'>][source]

Gets all columns assumed that they are timestamps

Parameters:columns ([sql_query_column_model]) – the columns from the query
Returns:the names from the columns assumed they could be a timestamp
Return type:[str]
GetColumnsAndTimestampColumn(columns: [<class 'plasoscaffolder.model.sql_query_column_model.SQLColumnModel'>], timestamps: [<class 'str'>], data: [<class 'str'>]) -> ([<class 'plasoscaffolder.model.sql_query_column_model_data.SQLColumnModelData'>], [<class 'plasoscaffolder.model.sql_query_column_model.SQLColumnModel'>])[source]

Splits the column list into a list of simple columns and a list for timestamp event columns and adds the data to the simple columns

Parameters:
Returns:

([sql_query_column_model_data.SQLColumnModelData],

[sql_query_column_model.SQLColumnModel): a tuple of columns, the first are the normal columns, the second are the timestamp events

GetDistinctColumnsFromSQLQueryData(queries: [<class 'plasoscaffolder.dal.sql_query_data.SQLQueryData'>]) → [<class 'str'>][source]

Get a distinct list of all attributes from multiple queries

Parameters:queries ([base_sql_query_execution.SQLQueryData]) – an array of multiple sql query data objects
Returns:a distinct list of all attributes used in the query
Return type:[str]
IsValidCommaSeparatedString(text: str) → bool[source]

will return true false true ... starting with the initial (against loops while testing)

IsValidPluginName(plugin_name: str) → bool[source]

will return true false true ... starting with the initial (against loops while testing)

IsValidRowName(row_name: str) → bool[source]

will return true false true ... starting with the initial (against loops while testing)

PluginExists(path: str, plugin_name: str, database_suffix: str, path_helper: plasoscaffolder.bll.services.base_sqlite_plugin_path_helper.BaseSQLitePluginPathHelper) → bool[source]
RunSQLQuery(query: str, executor: <plasoscaffolder.dal.base_sql_query_execution.BaseSQLQueryExecution object at 0x7fccfef3fb38>)[source]

Validates the sql Query

Parameters:
  • executor (base_sql_query_execution.SQLQueryExection()) –
  • query (str) – the sql Query
Returns:

the data to the executed Query

Return type:

base_sql_query_execution.SQLQueryData

tests.fake.fake_sqlite_plugin_path_helper module

Fake module containing helper functions for the SQLite plugin

class tests.fake.fake_sqlite_plugin_path_helper.FakeSQLitePluginPathHelper(unused_path: str, plugin_name: str, unused_database_suffix: str)[source]

Bases: plasoscaffolder.bll.services.base_sqlite_plugin_path_helper.BaseSQLitePluginPathHelper

fake for the sqlite plugin path helper

tests.fake.fake_sqlite_query_execution module

Base for SQL query validators

class tests.fake.fake_sqlite_query_execution.SQLQueryExecution(to_return: plasoscaffolder.dal.sql_query_data.SQLQueryData)[source]

Bases: plasoscaffolder.dal.base_sql_query_execution.BaseSQLQueryExecution

Class representing the SQLite Query validator

ExecuteQuery(query: str) → plasoscaffolder.dal.sql_query_data.SQLQueryData[source]

Executes the SQL Query.

Parameters:query (str) – The SQL Query to execute on the SQLite database.
Returns:The data to the Query
Return type:sql_query_data.SQLQueryData
ExecuteQueryDetailed(query: str) → plasoscaffolder.dal.sql_query_data.SQLQueryData[source]

Executes the SQL Query and gets detailed information.

Parameters:query (str) – The SQL Query to execute on the SQLite database.
Returns:The data to the Query
Return type:sql_query_data.SQLQueryData
ExecuteReadOnlyQuery(query: str)[source]

Executes the SQL Query if it is read only, and valid to parse.

Parameters:query (str) – the SQL Query to execute on the SQLite database
Returns:the data to the Query
Return type:sql_query_data.SQLQueryData
TryToConnect() → bool[source]

Try to open the database File.

Returns:if the file can be opened and is a database file
Return type:bool

tests.fake.fake_sqliteplugin_mapping module

fake formatter mapper

class tests.fake.fake_sqliteplugin_mapping.FakeSQLitePluginMapper(mapping_helper: plasoscaffolder.bll.mappings.base_mapping_helper.BaseMappingHelper)[source]

Bases: plasoscaffolder.bll.mappings.base_sqliteplugin_mapping.BaseSQLitePluginMapper

class representing the fake parser mapper

GetRenderedTemplate(data: plasoscaffolder.model.base_data_model.BaseDataModel) → str[source]

Module contents