Skip to content

Conversation

@mrsaicharan1
Copy link
Member

Part of #5320

Short description of what this resolves:

This moves the admin rights function to the helpers and adds a test to check it

Changes proposed in this pull request:

  • Shifted helper function
  • Added integration test

Checklist

  • I have read the Contribution & Best practices Guide and my PR follows them.
  • My branch is up-to-date with the Upstream development branch.
  • The unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • All the functions created/modified in this PR contain relevant docstrings.

@auto-label auto-label bot added the testing label Jun 20, 2019
logout_user()
self.assertEqual(auth_manager.is_accessible(), False)

def test_check_auth_admin(self):
Copy link
Member

Choose a reason for hiding this comment

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

I think you should also test with admin=False

Copy link
Member

Choose a reason for hiding this comment

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

You can create two users and one admin and other non-admin and this should give correct response for each of them

Copy link
Member Author

Choose a reason for hiding this comment

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

@poush Made the requested changes. Please have a look

@mrsaicharan1
Copy link
Member Author

mrsaicharan1 commented Jun 20, 2019 via email

@mrsaicharan1
Copy link
Member Author

mrsaicharan1 commented Jun 20, 2019 via email

@codecov
Copy link

codecov bot commented Jun 20, 2019

Codecov Report

❗ No coverage uploaded for pull request base (development@c10a3fc). Click here to learn what that means.
The diff coverage is 95%.

Impacted file tree graph

@@              Coverage Diff               @@
##             development    #6081   +/-   ##
==============================================
  Coverage               ?   66.17%           
==============================================
  Files                  ?      285           
  Lines                  ?    14133           
  Branches               ?        0           
==============================================
  Hits                   ?     9353           
  Misses                 ?     4780           
  Partials               ?        0
Impacted Files Coverage Δ
tests/all/integration/api/helpers/test_auth.py 97.91% <100%> (ø)
app/api/helpers/auth.py 92% <100%> (ø)
app/api/auth.py 23.34% <50%> (ø)

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 c10a3fc...146bad8. Read the comment docs.

@mrsaicharan1 mrsaicharan1 force-pushed the helpers-test branch 2 times, most recently from dd7bc47 to 73b35af Compare June 20, 2019 08:07
kushthedude
kushthedude previously approved these changes Jun 20, 2019
@mrsaicharan1 mrsaicharan1 changed the title test: Shifted function to helpers and added integration test test: Shifted admin check function and added integration test Jun 20, 2019
@fossasia fossasia deleted a comment Jun 20, 2019
@mrsaicharan1 mrsaicharan1 force-pushed the helpers-test branch 3 times, most recently from f95dba7 to 241ba79 Compare June 21, 2019 13:01
Hound fixes

Extend test case to non-admin & reduce LOC

Update tests/all/integration/api/helpers/test_auth.py
@mrsaicharan1
Copy link
Member Author

@shreyanshdwivedi @uds5501 @poush @iamareebjamal Made the suggested changes. Please have a look now.

@niranjan94 niranjan94 merged commit e812d43 into fossasia:development Jun 21, 2019
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.

7 participants