Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ with ZoomClient('CLIENT_ID', 'CLIENT_SECRET', 'ACCOUNT_ID') as client:
* client.user.get_by_email(...)
* client.user.get_settings(...)
* client.user.update_settings(...)
* client.user.add_assistants(...)
* client.user.delete_all_assistants(...)
* client.user.delete_assistant(...)
* client.user.list_assistants(...)

* client.meeting.get(...)
* client.meeting.end(...)
Expand Down
45 changes: 45 additions & 0 deletions tests/zoomus/components/user/test_add_assistants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import unittest

from zoomus import components, util
import responses


def suite():
"""Define all the tests of the module."""
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(AddAssistantsV2TestCase))
return suite


class AddAssistantsV2TestCase(unittest.TestCase):
def setUp(self):
self.component = components.user.UserComponentV2(
base_uri="http://foo.com",
config={
"api_key": "KEY",
"api_secret": "SECRET",
"version": util.API_VERSION_2,
},
)

@responses.activate
def test_can_add_assistants(self):
responses.add(responses.POST, "http://foo.com/users/ID/assistants")
response = self.component.add_assistants(
id="ID", assistants=[{"email": "foo@bar.com"}]
)
self.assertEqual(
response.request.body, '{"assistants": [{"email": "foo@bar.com"}]}'
)

def test_requires_id(self):
with self.assertRaisesRegexp(ValueError, "'id' must be set"):
self.component.add_assistants(assistants=[{"email": "foo@bar.com"}])

def test_requires_assistants(self):
with self.assertRaisesRegexp(ValueError, "'assistants' must be set"):
self.component.add_assistants(id="ID")


if __name__ == "__main__":
unittest.main()
36 changes: 36 additions & 0 deletions tests/zoomus/components/user/test_delete_all_assistants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import unittest

from zoomus import components, util
import responses


def suite():
"""Define all the tests of the module."""
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(DeleteAllAssistantsV2TestCase))
return suite


class DeleteAllAssistantsV2TestCase(unittest.TestCase):
def setUp(self):
self.component = components.user.UserComponentV2(
base_uri="http://foo.com",
config={
"api_key": "KEY",
"api_secret": "SECRET",
"version": util.API_VERSION_2,
},
)

@responses.activate
def test_can_delete_all_assistants(self):
responses.add(responses.DELETE, "http://foo.com/users/ID/assistants")
response = self.component.delete_all_assistants(id="ID")

def test_requires_id(self):
with self.assertRaisesRegexp(ValueError, "'id' must be set"):
self.component.delete_all_assistants()


if __name__ == "__main__":
unittest.main()
40 changes: 40 additions & 0 deletions tests/zoomus/components/user/test_delete_assistant.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import unittest

from zoomus import components, util
import responses


def suite():
"""Define all the tests of the module."""
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(DeleteAssistantV2TestCase))
return suite


class DeleteAssistantV2TestCase(unittest.TestCase):
def setUp(self):
self.component = components.user.UserComponentV2(
base_uri="http://foo.com",
config={
"api_key": "KEY",
"api_secret": "SECRET",
"version": util.API_VERSION_2,
},
)

@responses.activate
def test_can_add_assistants(self):
responses.add(responses.DELETE, "http://foo.com/users/ID/assistants/ASSISTID")
response = self.component.delete_assistant(id="ID", assistant_id="ASSISTID")

def test_requires_id(self):
with self.assertRaisesRegexp(ValueError, "'id' must be set"):
self.component.delete_assistant(assistant_id="ASSISTID")

def test_requires_assistant_id(self):
with self.assertRaisesRegexp(ValueError, "'assistant_id' must be set"):
self.component.delete_assistant(id="ID")


if __name__ == "__main__":
unittest.main()
36 changes: 36 additions & 0 deletions tests/zoomus/components/user/test_list_assistants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import unittest

from zoomus import components, util
import responses


def suite():
"""Define all the tests of the module."""
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(ListAssistantV2TestCase))
return suite


class ListAssistantV2TestCase(unittest.TestCase):
def setUp(self):
self.component = components.user.UserComponentV2(
base_uri="http://foo.com",
config={
"api_key": "KEY",
"api_secret": "SECRET",
"version": util.API_VERSION_2,
},
)

@responses.activate
def test_can_list_assistants(self):
responses.add(responses.GET, "http://foo.com/users/ID/assistants")
response = self.component.list_assistants(id="ID")

def test_requires_id(self):
with self.assertRaisesRegexp(ValueError, "'id' must be set"):
self.component.list_assistants(assistant_id="ASSISTID")


if __name__ == "__main__":
unittest.main()
1 change: 0 additions & 1 deletion tests/zoomus/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,6 @@ def test_can_convert_datetime_to_str(self):


class IsStrTypeTestCase(unittest.TestCase):

from sys import version_info

def test_str_is_str_type(self):
Expand Down
27 changes: 27 additions & 0 deletions zoomus/components/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,30 @@ def get_settings(self, **kwargs):
return self.get_request(
"/users/{}/settings".format(kwargs.pop("id")), params=kwargs
)

def add_assistants(self, **kwargs):
util.require_keys(kwargs, ["id", "assistants"])
body = {"assistants": kwargs["assistants"]}

return self.post_request(
"/users/{}/assistants".format(kwargs.pop("id")), data=kwargs
)

def list_assistants(self, **kwargs):
util.require_keys(kwargs, "id")

return self.get_request("/users/{}/assistants".format(kwargs.pop("id")))

def delete_assistant(self, **kwargs):
util.require_keys(kwargs, ["id", "assistant_id"])

return self.delete_request(
"/users/{id}/assistants/{assistant_id}".format(
id=kwargs.pop("id"), assistant_id=kwargs["assistant_id"]
)
)

def delete_all_assistants(self, **kwargs):
util.require_keys(kwargs, "id")

return self.delete_request("/users/{}/assistants".format(kwargs.pop("id")))