Skip to content

Commit

Permalink
NFS exports restored as read-only - continued 5 rockstor#2912
Browse files Browse the repository at this point in the history
- Additional test_post() with API / DB / Web-UI mapping info.
  • Loading branch information
phillxnet committed Nov 8, 2024
1 parent 70b696e commit 06cc9be
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/rockstor/storageadmin/tests/test_nfs_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,27 @@ def test_get(self):
response = self.client.get(f"{self.BASE_URL}/{nfs_id}")
self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response)

def test_post(self):
# Happy path - ensuring we create all that we intend.
# Clarifies current map re field naming of API vs DB vs Web-UI.

# API / DB / Web-UI field name map:
data = {
"shares": ("share2",),
"host_str": "*.edu", # 'host_str', "NFS Clients"
"admin_host": "example-host", # 'admin_host', "Admin Host"
"mod_choice": "rw", # 'editable', "Access type"
"sync_choice": "sync", # 'syncable', "Response type"
# "mount_security": "secure", # 'mount_security', NOT IMPLEMENTED.
}
response = self.client.post(self.BASE_URL, data=data)
self.assertEqual(response.status_code, status.HTTP_200_OK, msg=response.data)
self.assertEqual(response.data["host_str"], "*.edu")
self.assertEqual(response.data["admin_host"], "example-host")
self.assertEqual(response.data["editable"], "rw")
self.assertEqual(response.data["syncable"], "sync")
# self.assertEqual(response.data["mount_security"], "secure")

def test_invalid_get(self):
# get nfs-export with invalid id
response = self.client.get(f"{self.BASE_URL}/99999")
Expand Down

0 comments on commit 06cc9be

Please sign in to comment.