Bassa icon indicating copy to clipboard operation
Bassa copied to clipboard

add User tests for UserManager.py

Open carpecodeum opened this issue 5 years ago • 9 comments

Description

added tests for adding, removing and updatinng both normal and regular user for UserManager.py

#851

Motivation and Context

this will enhance testing for existing helper functions Screenshot 2020-01-22 at 1 07 16 PM after integrating with testing.mysqld Screenshot 2020-01-30 at 5 28 51 PM the existing tests Screenshot 2020-01-31 at 7 06 35 PM Screenshot 2020-02-05 at 12 28 35 AM

in UserManager.py

How Has This Been Tested?

Screenshots (In case of UI changes):

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [x] I have updated the documentation accordingly.
  • [x] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.

carpecodeum avatar Jan 22 '20 08:01 carpecodeum

@JaDogg please review this and tell me any necessary changes that need to be made in further tests. Also for writing future tests I was thinking of making a mock db. Please give your suggestions.

carpecodeum avatar Jan 22 '20 08:01 carpecodeum

@JaDogg please review this and tell me any necessary changes that need to be made in further tests. Also for writing future tests I was thinking of making a mock db. Please give your suggestions.

We can do this in few ways:

  1. Use an ORM like PonyORM or SQLAlchemy (SQLAlchemy has migrations so I'd pick that) & use an SQLite (memory) DB for testing.
  2. Just spin a docker image for testing. (We can also probably use dunner for this) - so the DB is created and discarded.

JaDogg avatar Jan 22 '20 10:01 JaDogg

@JaDogg please review this and tell me any necessary changes that need to be made in further tests. Also for writing future tests I was thinking of making a mock db. Please give your suggestions.

We can do this in few ways:

  1. Use an ORM like PonyORM or SQLAlchemy (SQLAlchemy has migrations so I'd pick that) & use an SQLite (memory) DB for testing.
  2. Just spin a docker image for testing. (We can also probably use dunner for this) - so the DB is created and discarded.

we can also checkout testing.mysqld module it automatically setups a mysqld instance in a temporary directory, and destroys it after testing. what are your thoughts?

carpecodeum avatar Jan 22 '20 11:01 carpecodeum

@JaDogg please review this and tell me any necessary changes that need to be made in further tests. Also for writing future tests I was thinking of making a mock db. Please give your suggestions.

We can do this in few ways:

  1. Use an ORM like PonyORM or SQLAlchemy (SQLAlchemy has migrations so I'd pick that) & use an SQLite (memory) DB for testing.
  2. Just spin a docker image for testing. (We can also probably use dunner for this) - so the DB is created and discarded.

we can also checkout testing.mysqld module it automatically setups a mysqld instance in a temporary directory, and destroys it after testing. what are your thoughts?

Will that work in Travis-CI 🤔 if so go ahead.

JaDogg avatar Jan 22 '20 17:01 JaDogg

@JaDogg I have integrated testing.mysqld module and it passes the travis-CI test given your permission I will implement this on the upcoming and the existing tests

carpecodeum avatar Jan 30 '20 11:01 carpecodeum

Can you change the file to user_tests.py

Sure!

carpecodeum avatar Jan 30 '20 16:01 carpecodeum

@JaDogg can you please help me with something I am not able to pass the token generated from the login test function inside a test class to subsequent test functions. Please suggest me away to to that.

carpecodeum avatar Jan 31 '20 13:01 carpecodeum

@JaDogg I have added a few changes that make the running of tests look better and more manageable and elaborate.

carpecodeum avatar Feb 04 '20 19:02 carpecodeum

@JaDogg Can you please tell me if there are any issues with this pr or is it good enough to be approved?

carpecodeum avatar Mar 16 '20 22:03 carpecodeum