diff --git a/tests/zoomus/components/meeting/test_delete_registrant.py b/tests/zoomus/components/meeting/test_delete_registrant.py new file mode 100644 index 0000000..739d560 --- /dev/null +++ b/tests/zoomus/components/meeting/test_delete_registrant.py @@ -0,0 +1,46 @@ +import datetime +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(DeleteRegistrantV2TestCase)) + return suite + + +class DeleteRegistrantV2TestCase(unittest.TestCase): + def setUp(self): + self.component = components.meeting.MeetingComponentV2( + base_uri="http://foo.com", + config={ + "api_key": "KEY", + "api_secret": "SECRET", + "version": util.API_VERSION_2, + }, + ) + + @responses.activate + def test_can_delete_registrant(self): + responses.add( + responses.DELETE, + "http://foo.com/meetings/ID/registrants/REGISTRANT_ID", + ) + self.component.delete_registrant( + id="ID", registrant_id ="REGISTRANT_ID" + ) + + def test_requires_meeting_id(self): + with self.assertRaisesRegexp(ValueError, "'id' must be set"): + self.component.delete_registrant() + + def test_requires_registrant_id(self): + with self.assertRaisesRegexp(ValueError, "'registrant_id' must be set"): + self.component.delete_registrant() + + +if __name__ == "__main__": + unittest.main() diff --git a/zoomus/components/meeting.py b/zoomus/components/meeting.py index 30bd0cb..c8fafa9 100644 --- a/zoomus/components/meeting.py +++ b/zoomus/components/meeting.py @@ -77,6 +77,12 @@ def add_registrant(self, **kwargs): "/meetings/{}/registrants".format(kwargs.get("id")), data=kwargs ) + def delete_registrant(self, **kwargs): + util.require_keys(kwargs, ["id", "registrant_id"]) + return self.delete_request( + "/meetings/{}/registrants/{}".format(kwargs.get("id"), kwargs.get("registrant_id")), data=kwargs + ) + def list_registrants(self, **kwargs): util.require_keys(kwargs, "id") return self.get_request(