tutorialdb
tutorialdb copied to clipboard
Tests required.
None of the apps have any tests written. We NEED tests ASAP.
Just having a headsup - we would be using the unittest
framework
I suggest using Django's testing APIs. That way we can perform isolated database transactions in our tests.
just committed some initial tests, I will try to list all the things to test here.
- Template Names :heavy_check_mark:
- URLs :x:
- Page Status Codes :heavy_check_mark:
- Context Data :x:
- Models :x:
What about the API? Can we test them as well?
What about the API? Can we test them as well?
Yes we can, testing them would be similar to testing views
Hi, I am participating in Hacktoberfest and would like to help on this project. I don't have much experience with testing in Python, but would love to learn and contribute.
@hstandeffer you can hack around with the taggie app. When you're comfortable with that module, then create a tests directory inside the taggie directory itself.
Use the unittest module. Here's a video tutorial for you to get started with the unittest module.
Test out the functionality of the module, such as whether the functions give expected output for a specific input.
@hstandeffer do this to run tests:
- Create a local branch.
- Update settings.py as follows:
STATIC_URL = '/static/'
STATIC_ROOT = os.environ['STATIC_ROOT']
# STATICFILES_DIRS = [os.path.join('static'),] # additional directories to collectstatic from, shouldn't contain STATIC_ROOT
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
- Update requirements.txt as follows (this applies only for development, not for production):
python-dotenv>=0.10.0
django-import-export>=1.0.0
whitenoise==3.3.1
gunicorn==19.7.1
- Add
static/
to .gitignore:
*.log
local_settings.py
db.sqlite3
static/
# Flask stuff:
instance/
- Create a directory by the name 'static' and then run
python manage.py collectstatic
. - Run tests with
python manage.py test
.
Do let me know if any problems arise.
I've followed these steps and it is throwing a key error for the line in your second step of the email for the ['STATIC_ROOT']
On Wed, Oct 9, 2019 at 1:32 PM MaDDogx [email protected] wrote:
@hstandeffer https://github.com/hstandeffer do this to run tests:
- Create a local branch.
- Update settings.py as follows:
STATIC_URL = '/static/'STATIC_ROOT = os.environ['STATIC_ROOT']
STATICFILES_DIRS = [os.path.join('static'),] # additional directories to collectstatic from, shouldn't contain STATIC_ROOTSTATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
- Update requirements.txt as follows (this applies only for development, not for production):
python-dotenv>=0.10.0 django-import-export>=1.0.0 whitenoise==3.3.1 gunicorn==19.7.1
- Add static/ to .gitignore.
- Create a directory by the name 'static' and then run python manage.py collectstatic.
- Run tests with python manage.py test.
Do let me know if any problems arise.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Bhupesh-V/tutorialdb/issues/9?email_source=notifications&email_token=AIJKXCPVPTIVT7K767X5CWLQNYPSPA5CNFSM4IHUZFW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAY32WY#issuecomment-540130651, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIJKXCOWMAQQT6JYNZXPZEDQNYPSPANCNFSM4IHUZFWQ .
-- Harrison Standeffer
Did you setup the .env
files properly?
The STATIC_ROOT
virtual environment variable needs to be an absolute path to the /static/
directory inside the tutorialdb root directory.
So, STATIC_ROOT
needs to be set to
C:\USER\path\to\tutorialdb\static\
inside .env
for Windows.