Bassa
Bassa copied to clipboard
add User tests for UserManager.py
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
after integrating with testing.mysqld
the existing tests
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.
@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.
@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:
- Use an ORM like PonyORM or SQLAlchemy (SQLAlchemy has migrations so I'd pick that) & use an SQLite (memory) DB for testing.
- Just spin a docker image for testing. (We can also probably use dunner for this) - so the DB is created and discarded.
@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:
- Use an ORM like PonyORM or SQLAlchemy (SQLAlchemy has migrations so I'd pick that) & use an SQLite (memory) DB for testing.
- 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?
@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:
- Use an ORM like PonyORM or SQLAlchemy (SQLAlchemy has migrations so I'd pick that) & use an SQLite (memory) DB for testing.
- 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 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
Can you change the file to
user_tests.py
Sure!
@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.
@JaDogg I have added a few changes that make the running of tests look better and more manageable and elaborate.
@JaDogg Can you please tell me if there are any issues with this pr or is it good enough to be approved?