Skip to content

Commit

Permalink
improve coverage. rockstor#1014
Browse files Browse the repository at this point in the history
  • Loading branch information
Mchakravartula committed Nov 16, 2015
1 parent 0cb751d commit 137336e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/rockstor/storageadmin/tests/test_disk_smart.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class DiskSmartTests(APITestMixin, APITestCase):
@classmethod
def setUpClass(cls):
super(DiskSmartTests, cls).setUpClass()


cls.patch_info = patch('storageadmin.views.disk_smart_info')
cls.mock_info = cls.patch_info.start()

@classmethod
def tearDownClass(cls):
Expand All @@ -39,7 +41,12 @@ def tearDownClass(cls):
def test_get(self):

# get base URL
response = self.client.get('%s/info' % self.BASE_URL)
response = self.client.get('%s' % self.BASE_URL)
self.assertEqual(response.status_code,
status.HTTP_200_OK, msg=response.data)

# get with disk name
response = self.client.get('%s/sdd' % self.BASE_URL)
self.assertEqual(response.status_code,
status.HTTP_200_OK, msg=response.data)

Expand Down
19 changes: 19 additions & 0 deletions src/rockstor/storageadmin/tests/test_disks.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,25 @@ def setUpClass(cls):
cls.mock_wipe_disk = cls.patch_wipe_disk.start()
cls.mock_wipe_disk.return_value = 'out','err', 0

cls.patch_scan_disks = patch('storageadmin.views.disk.scan_disks')
cls.mock_scan_disks = cls.patch_scan_disks.start()

cls.patch_blink_disk = patch('storageadmin.views.disk.blink_disk')
cls.mock_blink_disk = cls.patch_blink_disk.start()

cls.patch_pool_usage = patch('storageadmin.views.disk.pool_usage')
cls.mock_pool_usage = cls.patch_pool_usage.start()
cls.mock_pool_usage.return_value = (14680064, 10, 4194305)

cls.patch_mount_root = patch('storageadmin.views.disk.mount_root')
cls.mock_mount_root = cls.patch_mount_root.start()


cls.patch_pool_raid = patch('storageadmin.views.disk.pool_raid')
cls.mock_pool_raid = cls.patch_pool_raid.start()

cls.patch_enable_quota = patch('storageadmin.views.disk.enable_quota')
cls.mock_enable_quota = cls.patch_enable_quota.start()


@classmethod
Expand Down

0 comments on commit 137336e

Please sign in to comment.