Skip to content

Commit

Permalink
small improvements to input classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sascha Dobbelaere committed Nov 28, 2023
1 parent 71836fb commit 4309f2a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 38 deletions.
4 changes: 2 additions & 2 deletions OneSila/core/schema/multi_tenant/mutations/fields.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from core.schema.multi_tenant.types.input import MultiTenantCompanyMyInput, \
MultiTenantCompanyPartialInput, MultiTenantUserPartialInput, \
MultiTenantUserInput, MultiTenantInviteUserInput, MultiTenantAcceptInviteInput, \
MultiTenantUserInput, MultiTenantInviteUserInput, MultiTenantUserAcceptInviteInput, \
MultiTenantUserStatusInput
from core.schema.core.mutations import IsAuthenticated, default_extensions
from .mutation_classes import MyMultiTenantCompanyCreateMutation, \
Expand Down Expand Up @@ -36,7 +36,7 @@ def invite_user():

def accept_user_invitation():
extensions = []
return AcceptInvitationMutation(MultiTenantAcceptInviteInput, extensions=extensions)
return AcceptInvitationMutation(MultiTenantUserAcceptInviteInput, extensions=extensions)


def disable_user():
Expand Down
42 changes: 8 additions & 34 deletions OneSila/core/schema/multi_tenant/types/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,18 @@ class MultiTenantCompanyMyInput:
language: auto


@input(MultiTenantCompany)
@input(MultiTenantCompany, fields="__all__")
class MultiTenantCompanyInput:
name: auto
address1: auto
address2: auto
postcode: auto
city: auto
country: auto
language: auto
email: auto
phone_number: auto
vat_number: auto
website: auto
pass


@partial(MultiTenantCompany)
class MultiTenantCompanyPartialInput:
id: auto
name: auto
address1: auto
address2: auto
postcode: auto
city: auto
country: auto
language: auto
email: auto
phone_number: auto
vat_number: auto
website: auto
@partial(MultiTenantCompany, fields="__all__")
class MultiTenantCompanyPartialInput(NodeInput):
pass


@input(MultiTenantUser)
class MultiTenantAcceptInviteInput:
class MultiTenantUserAcceptInviteInput:
id: auto
username: auto
password: auto
Expand All @@ -62,14 +41,9 @@ class MultiTenantUserStatusInput:
id: auto


@partial(MultiTenantUser)
@partial(MultiTenantUser, fields="__all__")
class MultiTenantUserPartialInput:
id: auto
username: auto
password: auto
language: auto
first_name: auto
last_name: auto
pass


@input(MultiTenantUser)
Expand Down
6 changes: 4 additions & 2 deletions OneSila/core/tests/tests_schemas/tests_mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,11 @@ def test_invite_user(self):
variables={'username': username, 'password': "SomePaddk@2k2", "id": user_id}
)

print(resp)

self.assertTrue(resp.errors is None)
self.assertTrue(resp.data['inviteUser']['isActive'])
self.assertTrue(resp.data['inviteUser']['invitationAccepted'])
self.assertTrue(resp.data['acceptUserInvitation']['isActive'])
self.assertTrue(resp.data['acceptUserInvitation']['invitationAccepted'])

def test_enable_disable_user(self):
password = '22kk22@ksk!aAD'
Expand Down

0 comments on commit 4309f2a

Please sign in to comment.