Skip to content

Commit 2604536

Browse files
authored
Merge pull request #16 from djmitche/add-test-url-py
Add test_root_url in Python
2 parents 9daa0e3 + ad3e8a2 commit 2604536

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ root URL:
4040
When the `rootUrl` is `https://taskcluster.net`, the generated URLs will be to the Heroku cluster. Otherwise they will follow the
4141
[spec defined in this project](https://github.com/taskcluster/taskcluster-lib-urls/tree/master/docs/urls-spec.md).
4242

43-
`testRootUrl` is used to share a common `rootUrl` between various Taskcluster mocks in testing.
43+
`testRootUrl()` is used to share a common fake `rootUrl` between various Taskcluster mocks in testing.
44+
The URL does not resolve.
4445

4546
```js
4647
// Specifying root URL every time:
@@ -133,6 +134,10 @@ taskcluster_urls.exchange_reference(root_url, 'auth', 'v1')
133134
taskcluster_urls.ui(root_url, 'foo/bar')
134135
taskcluster_urls.servicesManifest(root_url)
135136
taskcluster_urls.docs(root_url, 'foo/bar')
137+
138+
And for testing,
139+
```python
140+
taskcluster_urls.test_root_url()
136141
```
137142

138143
Test with:

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,6 @@ module.exports = {
193193
* Useful for nock and such things.
194194
*/
195195
testRootUrl() {
196-
return 'https://tc-tests.localhost';
196+
return 'https://tc-tests.example.com';
197197
},
198198
};

taskcluster_urls/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,8 @@ def services_manifest(root_url):
5959
return 'https://references.taskcluster.net/manifest.json'
6060
else:
6161
return '{}/references/manifest.json'.format(root_url)
62+
63+
def test_root_url():
64+
"""Returns a standardized "testing" rootUrl that does not resolve but
65+
is easily recognizable in test failures."""
66+
return 'https://tc-tests.example.com'

0 commit comments

Comments
 (0)