diff --git a/canvasapi/account.py b/canvasapi/account.py index 4ba3dc66..30fb7bdb 100644 --- a/canvasapi/account.py +++ b/canvasapi/account.py @@ -825,9 +825,9 @@ def add_authentication_providers(self, **kwargs): :calls: `POST /api/v1/accounts/:account_id/authentication_providers \ `_ - :rtype: :class:`canvasapi.authentication_providers.AuthenticationProviders` + :rtype: :class:`canvasapi.authentication_provider.AuthenticationProvider` """ - from canvasapi.authentication_providers import AuthenticationProviders + from canvasapi.authentication_provider import AuthenticationProvider response = self._requester.request( 'POST', @@ -837,7 +837,7 @@ def add_authentication_providers(self, **kwargs): authentication_providers_json = response.json() authentication_providers_json.update({'account_id': self.id}) - return AuthenticationProviders(self._requester, authentication_providers_json) + return AuthenticationProvider(self._requester, authentication_providers_json) def list_authentication_providers(self, **kwargs): """ @@ -847,12 +847,12 @@ def list_authentication_providers(self, **kwargs): `_ :rtype: :class:`canvasapi.paginated_list.PaginatedList` of - :class:`canvasapi.authentication_providers.AuthenticationProviders` + :class:`canvasapi.authentication_provider.AuthenticationProvider` """ - from canvasapi.authentication_providers import AuthenticationProviders + from canvasapi.authentication_provider import AuthenticationProvider return PaginatedList( - AuthenticationProviders, + AuthenticationProvider, self._requester, 'GET', 'accounts/%s/authentication_providers' % (self.id), @@ -867,9 +867,9 @@ def get_authentication_providers(self, authentication_providers_id, **kwargs): :calls: `GET /api/v1/accounts/:account_id/authentication_providers/:id \ `_ - :rtype: :class:`canvasapi.authentication_providers.AuthenticationProviders` + :rtype: :class:`canvasapi.authentication_provider.AuthenticationProvider` """ - from canvasapi.authentication_providers import AuthenticationProviders + from canvasapi.authentication_provider import AuthenticationProvider response = self._requester.request( 'GET', @@ -877,7 +877,7 @@ def get_authentication_providers(self, authentication_providers_id, **kwargs): **combine_kwargs(**kwargs) ) - return AuthenticationProviders(self._requester, response.json()) + return AuthenticationProvider(self._requester, response.json()) def show_account_auth_settings(self, **kwargs): """ diff --git a/canvasapi/authentication_providers.py b/canvasapi/authentication_provider.py similarity index 77% rename from canvasapi/authentication_providers.py rename to canvasapi/authentication_provider.py index b5863c4c..3615d895 100644 --- a/canvasapi/authentication_providers.py +++ b/canvasapi/authentication_provider.py @@ -2,7 +2,7 @@ from canvasapi.util import combine_kwargs -class AuthenticationProviders(CanvasObject): +class AuthenticationProvider(CanvasObject): def __str__(self): # pragma: no cover return "{} ({})".format(self.auth_type, self.position) @@ -14,7 +14,7 @@ def update(self, **kwargs): :calls: `PUT /api/v1/accounts/:account_id/authentication_providers/:id \ `_ - :rtype: :class:`canvasapi.authentication_providers.AuthenticationProviders` + :rtype: :class:`canvasapi.authentication_provider.AuthenticationProvider` """ response = self._requester.request( 'PUT', @@ -23,7 +23,7 @@ def update(self, **kwargs): ) if response.json().get('auth_type'): - super(AuthenticationProviders, self).set_attributes(response.json()) + super(AuthenticationProvider, self).set_attributes(response.json()) return response.json().get('auth_type') @@ -34,10 +34,10 @@ def delete(self): :calls: `DELETE /api/v1/accounts/:account_id/authentication_providers/:id \ `_ - :rtype: :class:`canvasapi.authentication_providers.AuthenticationProviders` + :rtype: :class:`canvasapi.authentication_provider.AuthenticationProvider` """ response = self._requester.request( 'DELETE', 'accounts/%s/authentication_providers/%s' % (self.account_id, self.id) ) - return AuthenticationProviders(self._requester, response.json()) + return AuthenticationProvider(self._requester, response.json()) diff --git a/docs/authentication-providers-ref.rst b/docs/authentication-providers-ref.rst index dcb84b31..0b27aca9 100644 --- a/docs/authentication-providers-ref.rst +++ b/docs/authentication-providers-ref.rst @@ -1,6 +1,6 @@ -======================= -AuthenticationProviders -======================= +====================== +AuthenticationProvider +====================== -.. autoclass:: canvasapi.authentication_providers.AuthenticationProviders +.. autoclass:: canvasapi.authentication_provider.AuthenticationProvider :members: diff --git a/tests/test_account.py b/tests/test_account.py index 19a1f1e0..c296f4ea 100644 --- a/tests/test_account.py +++ b/tests/test_account.py @@ -13,7 +13,7 @@ from canvasapi.group import Group, GroupCategory from canvasapi.user import User from canvasapi.login import Login -from canvasapi.authentication_providers import AuthenticationProviders +from canvasapi.authentication_provider import AuthenticationProvider from tests import settings from tests.util import register_uris @@ -514,7 +514,7 @@ def test_list_authentication_providers(self, m): ] self.assertEqual(len(authentication_providers_list), 4) - self.assertIsInstance(authentication_providers_list[0], AuthenticationProviders) + self.assertIsInstance(authentication_providers_list[0], AuthenticationProvider) self.assertTrue(hasattr(authentication_providers_list[0], 'auth_type')) self.assertTrue(hasattr(authentication_providers_list[0], 'position')) @@ -524,7 +524,7 @@ def test_add_authentication_providers(self, m): new_authentication_provider = self.account.add_authentication_providers() - self.assertIsInstance(new_authentication_provider, AuthenticationProviders) + self.assertIsInstance(new_authentication_provider, AuthenticationProvider) self.assertTrue(hasattr(new_authentication_provider, 'auth_type')) self.assertTrue(hasattr(new_authentication_provider, 'position')) @@ -534,7 +534,7 @@ def test_get_authentication_providers(self, m): response = self.account.get_authentication_providers(1) - self.assertIsInstance(response, AuthenticationProviders) + self.assertIsInstance(response, AuthenticationProvider) # show_account_auth_settings() def test_show_account_auth_settings(self, m): diff --git a/tests/test_authentication_providers.py b/tests/test_authentication_providers.py index 3821939a..6e60a4a8 100644 --- a/tests/test_authentication_providers.py +++ b/tests/test_authentication_providers.py @@ -3,13 +3,13 @@ import requests_mock from canvasapi import Canvas -from canvasapi.authentication_providers import AuthenticationProviders +from canvasapi.authentication_provider import AuthenticationProvider from tests import settings from tests.util import register_uris @requests_mock.Mocker() -class TestAuthenticationProviders(unittest.TestCase): +class TestAuthenticationProvider(unittest.TestCase): @classmethod def setUp(self): @@ -42,7 +42,7 @@ def test_delete_authentication_providers(self, m): deleted_authentication_providers = self.authentication_providers.delete() - self.assertIsInstance(deleted_authentication_providers, AuthenticationProviders) + self.assertIsInstance(deleted_authentication_providers, AuthenticationProvider) self.assertTrue(hasattr(deleted_authentication_providers, 'auth_type')) self.assertEqual(deleted_authentication_providers.auth_type, 'Authentication Providers')