Opened 10 years ago
Closed 10 years ago
#23864 closed Bug (invalid)
UnitTest and sites framework
Reported by: | tomaszrycz | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | 1.7 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I can't pass test with sites framework.
python2.7 manage.py test --settings=project.settings_sport
def main_page(request): site = get_current_site(request) print("%s" % site.name) if site.name == 'sport': return sport.views.main_page(request)
Test has failed because site.name
during test has value example.com
but this value doesn't exist in database.
When I run server site.name
value is correct (sport
).
Note:
See TracTickets
for help on using tickets.
Please use support channels and only use this tracker for bugs in Django.
https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels