'Mocked `SWbemServices.ExecQuery` method.'

def ExecQuery(self, query, query_language, flags):

    self._exec_query_call_count += 1
    time.sleep(self._exec_query_run_time)
    SWbemServices._last_wmi_query = query
    SWbemServices._last_wmi_flags = flags
    results = []
    if (query in ['Select    AvgDiskBytesPerWrite,FreeMegabytes    from    Win32_PerfFormattedData_PerfDisk_LogicalDisk', 'Select    AvgDiskBytesPerWrite,FreeMegabytes,Name    from    Win32_PerfFormattedData_PerfDisk_LogicalDisk']):
        results += load_fixture('win32_perfformatteddata_perfdisk_logicaldisk', ('Name', 'C:'))
        results += load_fixture('win32_perfformatteddata_perfdisk_logicaldisk', ('Name', 'D:'))
    if (query == 'Select    CounterRawCount,CounterCounter,Timestamp_Sys100NS,Frequency_Sys100NS    from    Win32_PerfRawData_PerfOS_System'):
        sample_file = ('win32_perfrawdata_perfos_system_previous' if (flags == 131120) else 'win32_perfrawdata_perfos_system_current')
        results += load_fixture(sample_file, ('Name', 'C:'))
        results += load_fixture(sample_file, ('Name', 'D:'))
    if (query == 'Select    UnknownCounter,MissingProperty,Timestamp_Sys100NS,Frequency_Sys100NS    from    Win32_PerfRawData_PerfOS_System'):
        results += load_fixture('win32_perfrawdata_perfos_system_unknown', ('Name', 'C:'))
    if (query in ['Select    NonDigit,FreeMegabytes    from    Win32_PerfFormattedData_PerfDisk_LogicalDisk', 'Select    FreeMegabytes,NonDigit    from    Win32_PerfFormattedData_PerfDisk_LogicalDisk']):
        results += load_fixture('win32_perfformatteddata_perfdisk_logicaldisk', [('Name', 'C:'), ('NonDigit', 'Foo')])
    if ((query == "Select    IOReadBytesPerSec,IDProcess    from    Win32_PerfFormattedData_PerfProc_Process    WHERE    (    Name    =    'chrome'    )") or (query == "Select    IOReadBytesPerSec,UnknownProperty    from    Win32_PerfFormattedData_PerfProc_Process    WHERE    (    Name    =    'chrome'    )")):
        results += load_fixture('win32_perfformatteddata_perfproc_process')
    if (query == "Select    IOReadBytesPerSec,ResultNotMatchingAnyTargetProperty    from    Win32_PerfFormattedData_PerfProc_Process    WHERE    (    Name    =    'chrome'    )"):
        results += load_fixture('win32_perfformatteddata_perfproc_process_alt')
    if ((query == "Select    CommandLine    from    Win32_Process    WHERE    (    Handle    =    '4036'    )") or (query == "Select    UnknownProperty    from    Win32_Process    WHERE    (    Handle    =    '4036'    )")):
        results += load_fixture('win32_process')
    if (query == "Select    ServiceUptime,TotalBytesSent,TotalBytesReceived,TotalBytesTransferred,CurrentConnections,TotalFilesSent,TotalFilesReceived,TotalConnectionAttemptsAllInstances,TotalGetRequests,TotalPostRequests,TotalHeadRequests,TotalPutRequests,TotalDeleteRequests,TotalOptionsRequests,TotalTraceRequests,TotalNotFoundErrors,TotalLockedErrors,TotalAnonymousUsers,TotalNonAnonymousUsers,TotalCGIRequests,TotalISAPIExtensionRequests    from    Win32_PerfFormattedData_W3SVC_WebService    WHERE    (    Name    =    'Failing    site'    )    OR    (    Name    =    'Working    site'    )    OR    (    Name    =    'Default    Web    Site'    )"):
        results += load_fixture('win32_perfformatteddata_w3svc_webservice', ('Name', 'Default    Web    Site'))
        results += load_fixture('win32_perfformatteddata_w3svc_webservice', ('Name', 'Working    site'))
    if (query == "Select    ServiceUptime,TotalBytesSent,TotalBytesReceived,TotalBytesTransfered,CurrentConnections,TotalFilesSent,TotalFilesReceived,TotalConnectionAttemptsAllInstances,TotalGetRequests,TotalPostRequests,TotalHeadRequests,TotalPutRequests,TotalDeleteRequests,TotalOptionsRequests,TotalTraceRequests,TotalNotFoundErrors,TotalLockedErrors,TotalAnonymousUsers,TotalNonAnonymousUsers,TotalCGIRequests,TotalISAPIExtensionRequests    from    Win32_PerfFormattedData_W3SVC_WebService    WHERE    (    Name    =    'Failing    site'    )    OR    (    Name    =    'Working    site'    )    OR    (    Name    =    'Default    Web    Site'    )"):
        results += load_fixture('win32_perfformatteddata_w3svc_webservice_2008', ('Name', 'Default    Web    Site'))
        results += load_fixture('win32_perfformatteddata_w3svc_webservice_2008', ('Name', 'Working    site'))
    if (query == "Select    ServiceUptime,TotalBytesSent,TotalBytesReceived,TotalBytesTransferred,CurrentConnections,TotalFilesSent,TotalFilesReceived,TotalConnectionAttemptsAllInstances,TotalGetRequests,TotalPostRequests,TotalHeadRequests,TotalPutRequests,TotalDeleteRequests,TotalOptionsRequests,TotalTraceRequests,TotalNotFoundErrors,TotalLockedErrors,TotalAnonymousUsers,TotalNonAnonymousUsers,TotalCGIRequests,TotalISAPIExtensionRequests    from    Win32_PerfFormattedData_W3SVC_WebService    WHERE    (    Name    =    '_Total'    )"):
        results += load_fixture('win32_perfformatteddata_w3svc_webservice', ('Name', '_Total'))
    if (query == "Select    Name,State    from    Win32_Service    WHERE    (    Name    =    'WSService'    )    OR    (    Name    =    'WinHttpAutoProxySvc'    )"):
        results += load_fixture('win32_service_up', ('Name', 'WinHttpAutoProxySvc'))
        results += load_fixture('win32_service_down', ('Name', 'WSService'))
    if (query == "Select    EventCode,SourceName,TimeGenerated,Type,InsertionStrings,Message,Logfile    from    Win32_NTLogEvent    WHERE    (    (    SourceName    =    'MSSQLSERVER'    )    AND    (    Type    =    'Error'    OR    Type    =    'Warning'    )    AND    TimeGenerated    >=    '20151224113047.000000-480'    )"):
        results += load_fixture('win32_ntlogevent')
    return results
