Commit f7bac3d7 authored by Rob Carleski's avatar Rob Carleski 🇮🇸
Browse files

Add functionality for reserving a new group.

parent 6d6570b7
......@@ -301,11 +301,34 @@ class Client:
else:
raise Exception('{}: {}'.format(r.status_code, r.text))
# TODO: This endpoint appears to be broken right now.
# We should come back to this, though.
# Endpoint: /reserve/{dn}
def reserve_group(self, name):
pass
"""Reserve a new mcommunity group
Parameters
----------
name : str
The name of the mcommunity group to reserve
Returns
-------
none
Nothing returned. After creation, group is fetched.
"""
if self._validate_name(name):
endpoint = self.call_url + '/reserve'
data = {
'name': name
}
self.session.post(
url=endpoint,
data=json.dumps(data),
headers=self.headers,
timeout=self.timeout
)
self.fetch_group(name)
def update_group_aliases(self, aliases):
"""Update mcommunity group aliases
......
......@@ -25,6 +25,12 @@ def test_group_creation(mock_mcomm):
assert conn.group_data['name'] == 'testgroup'
def test_group_reservation(mock_mcomm):
conn = mcommunity.Client(config=config)
conn.reserve_group('testgroup')
assert conn.group_data['name'] == 'testgroup'
def test_group_deletion(mock_mcomm):
conn = mcommunity.Client(config=config)
r = conn.delete_group('testgroup')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment