Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sonic-thermalctld/tests/mock_swsscommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def get(self, key):
def get_size(self):
return (len(self.mock_dict))

def getKeys(self):
return list(self.mock_dict.keys())


class FieldValuePairs:
def __init__(self, fvs):
Expand Down
26 changes: 24 additions & 2 deletions sonic-thermalctld/tests/mocked_libs/swsscommon/swsscommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,32 @@
Mock implementation of swsscommon package for unit testing
'''

from swsssdk import ConfigDBConnector, SonicDBConfig, SonicV2Connector

STATE_DB = ''

class ConfigDBConnector:
"""
Mock ConfigDBConnector that avoids real Redis connections.
"""
def __init__(self, *args, **kwargs):
pass

def connect(self, *args, **kwargs):
pass

def get_table(self, table_name):
return {}

def get_entry(self, table, key):
return {}


class SonicV2Connector:
def __init__(self, *args, **kwargs):
pass

def connect(self, *args, **kwargs):
pass


class Table:
def __init__(self, db, table_name):
Expand Down
Loading