70
70
self.aliases = sorted(
71
['production', 'qastaging', 'staging', 'dogfood', 'dev', 'test_dev'])
71
['production', 'qastaging', 'staging', 'dogfood', 'dev',
73
74
def test_short_names(self):
74
75
# Ensure the short service names are all supported.
75
76
self.assertEqual(sorted(uris.service_roots.keys()), self.aliases)
76
77
self.assertEqual(sorted(uris.web_roots.keys()), self.aliases)
79
def test_edge_service_root_is_production(self):
80
# The edge server no longer exists, so if the client wants
81
# edge we give them production.
82
with warnings.catch_warnings(record=True) as caught:
83
warnings.simplefilter("always")
84
self.assertEqual(uris.lookup_service_root('edge'),
85
uris.lookup_service_root('production'))
87
# The lookup caused a deprecation warning.
88
self.assertEqual(len(caught), 1)
90
self.assertTrue(issubclass(warning.category, DeprecationWarning))
91
self.assertTrue("no longer exists" in warning.message.message)
93
def test_edge_service_root_is_production(self):
94
# The edge server no longer exists, so if the client wants
95
# edge we give them production.
96
with warnings.catch_warnings(record=True) as caught:
97
warnings.simplefilter("always")
98
self.assertEqual(uris.lookup_web_root('edge'),
99
uris.lookup_web_root('production'))
101
# The lookup caused a deprecation warning.
102
self.assertEqual(len(caught), 1)
104
self.assertTrue(issubclass(warning.category, DeprecationWarning))
105
self.assertTrue("no longer exists" in warning.message.message)
78
107
def test_lookups(self):
79
108
"""Ensure that short service names turn into long service names."""
81
110
# If the service name is a known alias, lookup methods convert
83
for alias in self.aliases:
85
uris.lookup_service_root(alias), uris.service_roots[alias])
87
uris.lookup_web_root(alias), uris.web_roots[alias])
112
with warnings.catch_warnings():
113
warnings.simplefilter("ignore")
114
for alias in self.aliases:
116
uris.lookup_service_root(alias), uris.service_roots[alias])
118
uris.lookup_web_root(alias), uris.web_roots[alias])
89
120
# If the service name is a valid URL, lookup methods let it