Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mjoshionemind committed Jan 17, 2024
1 parent 97c690f commit 3b3ff10
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 91 deletions.
34 changes: 17 additions & 17 deletions jelastic/api/users/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1334,7 +1334,7 @@ def Activate(
key: str,
password: str = None,
skip_send_email: bool = None,
code:str = None,
code: str = None,
reseller_id: int = None,
):
"""
Expand All @@ -1352,7 +1352,7 @@ def Activate(
"skipSendEmail": skip_send_email,
"code": code,
"resellerId": reseller_id,
}
},
)

def CheckEmailExist(
Expand Down Expand Up @@ -1394,7 +1394,7 @@ def CreateAccount(
password: str,
name: str = None,
check_email: bool = None,
welcome:str = None,
welcome: str = None,
skip_send_email: bool = None,
reseller_id: int = None,
):
Expand All @@ -1417,14 +1417,14 @@ def CreateAccount(
"welcome": welcome,
"skipSendEmail": skip_send_email,
"resellerId": reseller_id,
}
},
)

def CreateAuthKey(
self,
login: str,
solution: str,
auth_type:str = None,
auth_type: str = None,
expires_at: datetime = None,
type: str = None,
):
Expand All @@ -1444,7 +1444,7 @@ def CreateConfirmLinkUserKey(
self,
email: str,
role: str,
target_app_id:str = None,
target_app_id: str = None,
application_right: str = None,
):
"""
Expand All @@ -1458,12 +1458,12 @@ def CreateConfirmLinkUserKey(
"role": role,
"targetAppid": target_app_id,
"applicationRight": application_right,
}
},
)

def GeneratePassword(
self,
length: int= None,
length: int = None,
):
"""
param length: define password length (default value is set by password policy: minLength, can not be less than minLength)
Expand Down Expand Up @@ -1520,7 +1520,7 @@ def Create(self, display_name: str, owner_uid: int = None):
params={
"displayName": display_name,
"ownerUid": owner_uid,
}
},
)

def Delete(self, team_id: int, owner_uid: int = None):
Expand All @@ -1533,7 +1533,7 @@ def Delete(self, team_id: int, owner_uid: int = None):
params={
"teamId": team_id,
"ownerUid": owner_uid,
}
},
)

def DeleteMember(self, member_id: int, owner_uid: int = None):
Expand All @@ -1546,15 +1546,15 @@ def DeleteMember(self, member_id: int, owner_uid: int = None):
params={
"memberId": member_id,
"ownerUid": owner_uid,
}
},
)

def Edit(
self,
team_id: int,
display_name: str = None,
external_id: str = None,
owner_uid:int = None,
owner_uid: int = None,
):
"""
param team_id: unique identifier of the collaboration Team
Expand All @@ -1568,18 +1568,18 @@ def Edit(
"displayName": display_name,
"externalId": external_id,
"ownerUid": owner_uid,
}
},
)

def Get(self, owner_uid:int = None):
def Get(self, owner_uid: int = None):
"""
param owner_uid: unique identifier of the collaboration Team owner.
"""
return self._get(
"Get",
params={
"ownerUid": owner_uid,
}
},
)

def Invite(
Expand All @@ -1602,7 +1602,7 @@ def Invite(
"teamId": team_id,
"displayName": display_name,
"ownerUid": owner_uid,
}
},
)

def ResendInvite(self, member_id: int, owner_uid: int = None):
Expand All @@ -1615,5 +1615,5 @@ def ResendInvite(self, member_id: int, owner_uid: int = None):
params={
"memberId": member_id,
"ownerUid": owner_uid,
}
},
)
49 changes: 16 additions & 33 deletions tests/unit/test_api/test_users/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@

def test_activate(client):
client._get.return_value = success_response
response = client.Registration.Activate(
"key","password", True, "code", 1
)
response = client.Registration.Activate("key", "password", True, "code", 1)
client._get.assert_called_with(
"Activate",
params={
"key": "key",
"password":"password",
"password": "password",
"skipSendEmail": True,
"code": "code",
"resellerId":1
}
"resellerId": 1,
},
)

assert response == success_response
Expand Down Expand Up @@ -54,25 +52,19 @@ def test_clear_sms_list_data(client):
def test_create_account(client):
client._get.return_value = success_response
response = client.Registration.CreateAccount(
"email",
"password",
"name",
True,
"welcome",
True,
1
"email", "password", "name", True, "welcome", True, 1
)
client._get.assert_called_with(
"CreateAccount",
params={
"email": "email",
"password": "password",
"name": "name",
"checkEmail":True,
"checkEmail": True,
"welcome": "welcome",
"skipSendEmail": True,
"resellerId": 1
}
"resellerId": 1,
},
)

assert response == success_response
Expand All @@ -81,20 +73,16 @@ def test_create_account(client):
def test_create_auth_key(client):
client._get.return_value = success_response
response = client.Registration.CreateAuthKey(
"login",
"solution",
"authType",
CURRENT_DATETIME,
"type"
"login", "solution", "authType", CURRENT_DATETIME, "type"
)
client._get.assert_called_with(
"CreateAuthKey",
params={
"login": "login",
"solution": "solution",
"authType": "authType",
"authType": "authType",
"expiresAt": CURRENT_DATETIME,
"type": "type"
"type": "type",
},
datetime_format="%Y-%m-%d %H:%M:%S",
)
Expand All @@ -105,19 +93,16 @@ def test_create_auth_key(client):
def test_create_confirm_link_user_key(client):
client._get.return_value = success_response
response = client.Registration.CreateConfirmLinkUserKey(
"email",
"role",
"targetAppid",
"applicationRight"
"email", "role", "targetAppid", "applicationRight"
)
client._get.assert_called_with(
"CreateConfirmLinkUserKey",
params={
"email": "email",
"role": "role",
"targetAppid": "targetAppid",
"applicationRight": "applicationRight"
}
"applicationRight": "applicationRight",
},
)

assert response == success_response
Expand Down Expand Up @@ -146,16 +131,14 @@ def test_resend_invitation(client):

def test_send_sms(client):
client._get.return_value = success_response
response = client.Registration.SendSms(
"activation_key", "email", "phone", "lang"
)
response = client.Registration.SendSms("activation_key", "email", "phone", "lang")
client._get.assert_called_with(
"SendSms",
params={
"activationKey ": "activation_key",
"email": "email",
"phone": "phone",
"lang":"lang"
"lang": "lang",
},
)
assert response == success_response
55 changes: 14 additions & 41 deletions tests/unit/test_api/test_users/test_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@

def test_create(client):
client._get.return_value = success_response
response = client.Team.Create( "displayName", 1)
response = client.Team.Create("displayName", 1)
client._get.assert_called_with(
"Create",
params={
"displayName": "displayName",
"ownerUid": 1
}
"Create", params={"displayName": "displayName", "ownerUid": 1}
)

assert response == success_response
Expand All @@ -18,44 +14,32 @@ def test_create(client):
def test_delete(client):
client._get.return_value = success_response
response = client.Team.Delete(1, 1)
client._get.assert_called_with(
"Delete",
params={
"teamId": 1,
"ownerUid": 1
}
)
client._get.assert_called_with("Delete", params={"teamId": 1, "ownerUid": 1})

assert response == success_response


def test_delete_member_team(client):
client._get.return_value = success_response
response = client.Team.DeleteMember(1,1)
response = client.Team.DeleteMember(1, 1)
client._get.assert_called_with(
"DeleteMember",
params={
"memberId": 1,
"ownerUid":1
}
"DeleteMember", params={"memberId": 1, "ownerUid": 1}
)

assert response == success_response


def test_edit(client):
client._get.return_value = success_response
response = client.Team.Edit(
1, "displayName", "externalId",1
)
response = client.Team.Edit(1, "displayName", "externalId", 1)
client._get.assert_called_with(
"Edit",
params={
"teamId": 1,
"displayName": "displayName",
"externalId": "externalId",
"ownerUid": 1
}
"ownerUid": 1,
},
)

assert response == success_response
Expand All @@ -64,29 +48,22 @@ def test_edit(client):
def test_get(client):
client._get.return_value = success_response
response = client.Team.Get(1)
client._get.assert_called_with(
"Get",
params={
"ownerUid":1
}
)
client._get.assert_called_with("Get", params={"ownerUid": 1})

assert response == success_response


def test_invite(client):
client._get.return_value = success_response
response = client.Team.Invite(
"email", 1, "displayName", 1
)
response = client.Team.Invite("email", 1, "displayName", 1)
client._get.assert_called_with(
"Invite",
params={
"email": "email",
"teamId": 1,
"displayName":"displayName",
"ownerUid": 1
}
"displayName": "displayName",
"ownerUid": 1,
},
)

assert response == success_response
Expand All @@ -96,11 +73,7 @@ def test_resend_invite(client):
client._get.return_value = success_response
response = client.Team.ResendInvite(1, 1)
client._get.assert_called_with(
"ResendInvite",
params={
"memberId": 1,
"ownerUid": 1
}
"ResendInvite", params={"memberId": 1, "ownerUid": 1}
)

assert response == success_response

0 comments on commit 3b3ff10

Please sign in to comment.