Skip to content

Commit

Permalink
Renamed AuthenticationProviders to AuthenticationProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
Thetwam committed Jun 16, 2017
1 parent d969a64 commit 76508d0
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
18 changes: 9 additions & 9 deletions canvasapi/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,9 +825,9 @@ def add_authentication_providers(self, **kwargs):
:calls: `POST /api/v1/accounts/:account_id/authentication_providers \
<https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.create>`_
: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',
Expand All @@ -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):
"""
Expand All @@ -847,12 +847,12 @@ def list_authentication_providers(self, **kwargs):
<https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.index>`_
: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),
Expand All @@ -867,17 +867,17 @@ def get_authentication_providers(self, authentication_providers_id, **kwargs):
:calls: `GET /api/v1/accounts/:account_id/authentication_providers/:id \
<https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.show>`_
: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',
'accounts/%s/authentication_providers/%s' % (self.id, authentication_providers_id),
**combine_kwargs(**kwargs)
)

return AuthenticationProviders(self._requester, response.json())
return AuthenticationProvider(self._requester, response.json())

def show_account_auth_settings(self, **kwargs):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -14,7 +14,7 @@ def update(self, **kwargs):
:calls: `PUT /api/v1/accounts/:account_id/authentication_providers/:id \
<https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.update>`_
:rtype: :class:`canvasapi.authentication_providers.AuthenticationProviders`
:rtype: :class:`canvasapi.authentication_provider.AuthenticationProvider`
"""
response = self._requester.request(
'PUT',
Expand All @@ -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')

Expand All @@ -34,10 +34,10 @@ def delete(self):
:calls: `DELETE /api/v1/accounts/:account_id/authentication_providers/:id \
<https://canvas.instructure.com/doc/api/authentication_providers.html#method.account_authorization_configs.destroy>`_
: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())
8 changes: 4 additions & 4 deletions docs/authentication-providers-ref.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
=======================
AuthenticationProviders
=======================
======================
AuthenticationProvider
======================

.. autoclass:: canvasapi.authentication_providers.AuthenticationProviders
.. autoclass:: canvasapi.authentication_provider.AuthenticationProvider
:members:
8 changes: 4 additions & 4 deletions tests/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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'))

Expand All @@ -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'))

Expand All @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_authentication_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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')

Expand Down

0 comments on commit 76508d0

Please sign in to comment.