Update documentation regarding running tests when using a subdomain in application routing
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 42/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- python
- Domain
- documentation, testing
Research direction
Start with tornado/test/routing_test.py, especially the HostMatchingTest cases linked in the issue, and locate the documentation section covering subdomain routing and AsyncHTTPTestCase. Document that subdomain-routed tests need an appropriate Host header, then verify the guidance matches the existing routing tests.
Written by the indexing model from the issue text.
Description
I had an existing set of tests that subclass AsyncHTTPTestCase and call routes defined as /api/some/route via the self.fetch method. These work fine.
I decided that I would like the api stuff to live at a subdomain -- api.mysite.tld -- and I followed the instructions laid out here https://stackoverflow.com/a/25592711
I ran my existing tests and they, of course, didnt work. Did some digging and found this test case which seems to resolve the issue (I need to add a Host header in my test cases) https://github.com/tornadoweb/tornado/blob/master/tornado/test/routing_test.py#L199-L227 ( && the HostMatchingTest cases)
Long story long. I setup
app.add_handlers(r'^api\..*', API_ROUTES)
and needed to pass a header value of Host: api. in order to get my existing tests to pass.
Could the documentation be updated to talk about how to test when using subdomain routing? Where should this be outlined at? I wouldn't mind adding some verbiage
- Dominant language
- Python
- Stars
- 22.2k
- Forks
- 5.6k
- Avg merge
- 3h 42m
- Merged PRs (30d)
- 16
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tornadoweb/tornado
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
tornadoweb/tornado#3701 · 1 comment ·
-
httpserver
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
tornadoweb/tornado#1050 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
tornadoweb/tornado#3728 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 64/100
tornadoweb/tornado#3651 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 50/100
tornadoweb/tornado#3616 · 2 comments ·
All issues in tornadoweb/tornado
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100