def test_kernel_modules_with_attrs(self): ''' Test the results returned from the kernel_modules function with attributes ''' _table_attrs_results = ['address', 'name', 'size', 'status', 'used_by'] _os_query_results = { 'data': [{ 'name': 'nls_utf8', 'status': 'Live' }, { 'name': 'udf', 'status': 'Live' }, { 'name': 'crc_itu_t', 'status': 'Live' }], 'result': True } with patch.object(osquery, '_table_attrs', MagicMock(return_value=_table_attrs_results)): with patch.object(osquery, '_osquery', MagicMock(return_value=_os_query_results)): with patch.dict(osquery.__grains__, {'os_family': 'Debian'}): self.assertEqual( osquery.kernel_modules(attrs=['name', 'status']), _os_query_results)
def test_kernel_modules_with_attrs(self): """ Test the results returned from the kernel_modules function with attributes """ _table_attrs_results = ["address", "name", "size", "status", "used_by"] _os_query_results = { "data": [ { "name": "nls_utf8", "status": "Live" }, { "name": "udf", "status": "Live" }, { "name": "crc_itu_t", "status": "Live" }, ], "result": True, } with patch.object(osquery, "_table_attrs", MagicMock(return_value=_table_attrs_results)): with patch.object(osquery, "_osquery", MagicMock(return_value=_os_query_results)): with patch.dict(osquery.__grains__, {"os_family": "Debian"}): self.assertEqual( osquery.kernel_modules(attrs=["name", "status"]), _os_query_results, )
def test_kernel_modules(self): ''' Test the results returned from the kernel_modules function ''' _os_query_results = { 'data': [{ 'address': '0xffffffffc14f2000', 'name': 'nls_utf8', 'size': '16384', 'status': 'Live', 'used_by': '-' }, { 'address': '0xffffffffc1599000', 'name': 'udf', 'size': '90112', 'status': 'Live', 'used_by': '-' }, { 'address': '0xffffffffc14b5000', 'name': 'crc_itu_t', 'size': '16384', 'status': 'Live', 'used_by': 'udf' }], 'result': True } with patch.object(osquery, '_osquery', MagicMock(return_value=_os_query_results)): with patch.dict(osquery.__grains__, {'os_family': 'Debian'}): self.assertEqual(osquery.kernel_modules(), _os_query_results)
def test_kernel_modules(self): """ Test the results returned from the kernel_modules function """ _os_query_results = { "data": [ { "address": "0xffffffffc14f2000", "name": "nls_utf8", "size": "16384", "status": "Live", "used_by": "-", }, { "address": "0xffffffffc1599000", "name": "udf", "size": "90112", "status": "Live", "used_by": "-", }, { "address": "0xffffffffc14b5000", "name": "crc_itu_t", "size": "16384", "status": "Live", "used_by": "udf", }, ], "result": True, } with patch.object(osquery, "_osquery", MagicMock(return_value=_os_query_results)): with patch.dict(osquery.__grains__, {"os_family": "Debian"}): self.assertEqual(osquery.kernel_modules(), _os_query_results)