-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c72d3c0
commit 09f3c67
Showing
10 changed files
with
201 additions
and
239 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
''' | ||
Mock implementation of swsscommon package for unit testing | ||
''' | ||
|
||
from swsssdk import ConfigDBConnector, SonicDBConfig, SonicV2Connector | ||
|
||
STATE_DB = '' | ||
|
||
|
||
class Table: | ||
def __init__(self, db, table_name): | ||
self.table_name = table_name | ||
self.mock_dict = {} | ||
self.mock_keys = ['sda'] | ||
|
||
def _del(self, key): | ||
del self.mock_dict[key] | ||
pass | ||
|
||
def set(self, key, fvs): | ||
self.mock_dict[key] = fvs.fv_dict | ||
pass | ||
|
||
def get(self, key): | ||
if key in self.mock_dict: | ||
return self.mock_dict[key] | ||
return None | ||
|
||
def get_size(self): | ||
return (len(self.mock_dict)) | ||
|
||
def getKeys(self): | ||
return self.mock_keys | ||
|
||
def hgetall(self): | ||
return self.mock_dict | ||
|
||
|
||
class FieldValuePairs: | ||
fv_dict = {} | ||
|
||
def __init__(self, tuple_list): | ||
if isinstance(tuple_list, list) and isinstance(tuple_list[0], tuple): | ||
self.fv_dict = dict(tuple_list) | ||
|
||
def __setitem__(self, key, kv_tuple): | ||
self.fv_dict[kv_tuple[0]] = kv_tuple[1] | ||
|
||
def __getitem__(self, key): | ||
return self.fv_dict[key] | ||
|
||
def __eq__(self, other): | ||
if not isinstance(other, FieldValuePairs): | ||
# don't attempt to compare against unrelated types | ||
return NotImplemented | ||
|
||
return self.fv_dict == other.fv_dict | ||
|
||
def __repr__(self): | ||
return repr(self.fv_dict) | ||
|
||
def __str__(self): | ||
return repr(self.fv_dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ | |
Mock implementation of sonic_platform package for unit testing | ||
""" | ||
|
||
from . import ssd | ||
from . import pcie | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
""" | ||
Mock implementation of sonic_platform package for unit testing | ||
""" | ||
|
||
from sonic_platform_base.pcie_base import PcieBase | ||
|
||
|
||
class Pcie(PcieBase): | ||
def __init__(self): | ||
self.platform_pcieutil = "/tmp/Pcie" | ||
|
||
def __str__(self): | ||
return self.platform_pcieutil |
This file was deleted.
Oops, something went wrong.
127 changes: 0 additions & 127 deletions
127
sonic-stormond/tests/mocked_libs/sonic_platform_base/sonic_storage/ssd.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
sonic-stormond/tests/mocked_libs/sonic_platform_base/sonic_storage/storage_devices.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
BLKDEV_BASE_PATH = '' | ||
|
||
class StorageDevices: | ||
def __init__(self): | ||
self.devices = {'sda' : None} | ||
|
||
def _get_storage_devices(self): | ||
pass | ||
|
||
def _storage_device_object_factory(self, key): | ||
pass |
Oops, something went wrong.