Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add session state transition validation #7156

Merged
merged 1 commit into from
Jul 23, 2020

Conversation

iamareebjamal
Copy link
Member

@iamareebjamal iamareebjamal commented Jul 23, 2020

Fixes #7149

assert json.loads(response.data) == {
'errors': [
{
'detail': f'You cannot change a session state from "{state}" to "{new_state}"',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (99 > 90 characters)

owner = new_user
creator = user
session = SessionSubFactory(creator_id=creator.id, **kwargs)
role, _ = get_or_create(Role, name='owner', title_name='Owner')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Black would make changes.

except KeyError:
raise ForbiddenError(
{'pointer': '/data/attributes/state'},
f'You cannot change a session state from "{session.state}" to "{new_state}"',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (97 > 90 characters)

@auto-label auto-label bot added the feature label Jul 23, 2020
@niranjan94
Copy link
Member

Codacy Here is an overview of what got changed by this pull request:

Complexity increasing per file
==============================
- tests/all/integration/api/session/test_session_state_api.py  7
         

Complexity decreasing per file
==============================
+ app/api/schema/sessions.py  -3
         

See the complete overview on Codacy

@codecov
Copy link

codecov bot commented Jul 23, 2020

Codecov Report

Merging #7156 into development will increase coverage by 0.11%.
The diff coverage is 92.85%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #7156      +/-   ##
===============================================
+ Coverage        62.73%   62.84%   +0.11%     
===============================================
  Files              262      262              
  Lines            13046    13055       +9     
===============================================
+ Hits              8184     8205      +21     
+ Misses            4862     4850      -12     
Impacted Files Coverage Δ
app/api/schema/sessions.py 93.24% <ø> (+2.33%) ⬆️
app/api/sessions.py 55.12% <92.30%> (+7.90%) ⬆️
app/api/helpers/scheduled_jobs.py 47.77% <100.00%> (ø)
app/models/user.py 60.67% <0.00%> (+0.37%) ⬆️
app/api/helpers/permission_manager.py 57.34% <0.00%> (+1.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce3c39f...8fefa33. Read the comment docs.

@iamareebjamal iamareebjamal merged commit 635bca8 into development Jul 23, 2020
@iamareebjamal iamareebjamal deleted the session-state-transition branch July 23, 2020 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add session status change validations
3 participants