-
Notifications
You must be signed in to change notification settings - Fork 446
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
Issue 54 add tests to django example app #434
Issue 54 add tests to django example app #434
Conversation
… urls.py. Update README.md with info on how to clean the example app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @hansdereber, thanks for contributing and nice work!
I have just a few comments about your changes.
from django.test import TestCase | ||
from django.utils import timezone | ||
|
||
from ..models import Question |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the full module name here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
from django.urls import reverse | ||
from django.utils import timezone | ||
|
||
from ..models import Question |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use the full module name here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
README.md
Outdated
@@ -102,6 +103,8 @@ Add the libname to either requirements.in or dev-requirents.in, then either upgr | |||
|
|||
### Cleaning example code | |||
Before start creating your own apps, run the command `make clean_examples` in order to clean up the example apps from the front and backend. | |||
Deregister the example app by removing `'exampleapp.apps.ExampleappConfig'` from ``{{project_name}}/settings/base.py`` and adjust |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step would be better to be done before the command make clean_examples
. Just to avoid getting errors after removing the code. Please also mention that the example app URLs should be removed from {{project_name}}/urls.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
# Conflicts: # Makefile # backend/project_name/settings/base.py # backend/project_name/settings/test.py # backend/project_name/urls.py
This reverts commit e502c90
@jhgv thanks for the quick reply! I have made the changes to the module import and the README as suggested. Also I needed to change the circle ci config.yaml file to make the django unit tests work in the ci. The issue was, that the tests for the views require the webpack-stats.json file to be build by "npm build". For this i have reordered the config.yaml file. It now builds and tests the frontend first, then it builds and tests the backend. Now the ci build is green with all 10 tests passing. Kindly check the PR again. |
@jhgv : could you take a look at the changes in this pr. If this is too big, i can remove 4 tests which then avoids touching the circleci change. But imho the proposed change in the circleci config makes sense. What do you think? |
Hi @hansdereber! Sorry for the delay, it's been a tough last two weeks. Everything looks great but I have one more concern. Before removing the example code, it will be nice to remove the exampleapp tables that were generated. It is possible with the command: What do you think? |
…s-to-django-example-app
…' and update README.md
@jhgv removing the tables is a good idea 👍 I have added a single line in the Makefile as suggested and adapted the README as well. The steps in the README are now with bulletpoints which looks cleaner. I did a full smoke test on the creation and removal of the sample app and I am confident that everything works as expected. Kindly check the updated pr. ps: It turns out that you cannot deregister the exampleapp from the INSTALLED_APPS list before running the 'zero' command. Therefore the order of steps to remove the sample app has changed in the README. |
Hey @jhgv, bump for this PR. |
LGTM ✔️ 📦 ! Thank you for contributing! |
Views, models and tests have been included into the example app. These follow the tutorial in the Django documentation.
Description
I would like to contribute to this project and picked the issue #54 to implement. I extended the example app with views, models and tests.
This relates to the issue "Add tests to django example app" #54
The example app is for displaying and voting on polls. This is follows the official Django tutorial from Django 2.2 that can be found here: https://docs.djangoproject.com/en/2.2/intro/tutorial01/
I have tested the changes to the project with a fresh install following the README.md and checked that installation, build and running is ok.
Motivation and Context
I have created views, models and corresponding tests to showcase a typlical Django app.
Screenshots (if appropriate):
Steps to reproduce (if appropriate):
Types of changes
Checklist: