-
Notifications
You must be signed in to change notification settings - Fork 429
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add functionality to get invited users for a user and resend pending …
…invites
- Loading branch information
1 parent
8e84e58
commit 1192284
Showing
5 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,6 +87,26 @@ def test_should_fail_if_invite_exists_already(self): | |
invites = Invite.objects.filter(email=email, organisation=organisation) | ||
self.assertEquals(len(invites), 1) | ||
|
||
def test_should_return_all_invites_and_can_resend(self): | ||
# Given | ||
client = self.set_up() | ||
organisation_2 = Organisation.objects.create(name="Test org 2") | ||
invite_1 = Invite.objects.create(email="[email protected]", | ||
frontend_base_url="https://www.example.com", | ||
organisation=organisation_2) | ||
invite_2 = Invite.objects.create(email="[email protected]", | ||
frontend_base_url="https://www.example.com", | ||
organisation=organisation_2) | ||
|
||
# When | ||
invite_list_response = client.get('/api/v1/organisations/%s/invites/' % organisation_2.id) | ||
invite_resend_response = client.post('/api/v1/organisations/%s/invites/%s/resend/' % ( | ||
organisation_2.id, invite_1.id)) | ||
|
||
# Then | ||
self.assertEquals(invite_list_response.status_code, status.HTTP_200_OK) | ||
self.assertEquals(invite_resend_response.status_code, status.HTTP_200_OK) | ||
|
||
|
||
class ProjectTestCase(TestCase): | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
from django.conf.urls import url, include | ||
from rest_framework_nested import routers | ||
|
||
from organisations.views import InviteViewSet | ||
from . import views | ||
|
||
|
||
router = routers.DefaultRouter() | ||
router.register(r'', views.OrganisationViewSet, base_name="organisation") | ||
|
||
organisations_router = routers.NestedSimpleRouter(router, r'', lookup="organisation") | ||
organisations_router.register(r'invites', InviteViewSet, base_name="organisation-invites") | ||
|
||
app_name = "organisations" | ||
|
||
urlpatterns = [ | ||
url(r'^', include(router.urls)), | ||
url(r'^', include(organisations_router.urls)) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters