Updated origin validation (bug 892604)
This commit is contained in:
Родитель
cb339548da
Коммит
65c5393ad6
|
@ -180,7 +180,8 @@ class WebappSpec(Spec):
|
|||
},
|
||||
"origin": {
|
||||
"expected_type": types.StringTypes,
|
||||
"value_matches": r"app://.+",
|
||||
"value_matches": r"^app://[a-z0-9]+([-.]{1}[a-z0-9]+)*"
|
||||
r"\.[a-z]{2,5}$"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -842,10 +842,25 @@ class TestWebapps(TestCase):
|
|||
self.assert_failed(with_errors=True)
|
||||
|
||||
def test_origin_pass(self):
|
||||
self.data['origin'] = 'app://hello'
|
||||
self.data['origin'] = 'app://domain.com'
|
||||
self.analyze()
|
||||
self.assert_silent()
|
||||
|
||||
def test_origin_dashes(self):
|
||||
self.data['origin'] = 'app://my-domain.com'
|
||||
self.analyze()
|
||||
self.assert_silent()
|
||||
|
||||
def test_origin_subdomains(self):
|
||||
self.data['origin'] = 'app://sub.domain.com'
|
||||
self.analyze()
|
||||
self.assert_silent()
|
||||
|
||||
def test_origin_non_fqdn(self):
|
||||
self.data['origin'] = 'app://hello'
|
||||
self.analyze()
|
||||
self.assert_failed(with_errors=True)
|
||||
|
||||
def test_origin_type(self):
|
||||
self.data['origin'] = 123
|
||||
self.analyze()
|
||||
|
@ -855,3 +870,13 @@ class TestWebapps(TestCase):
|
|||
self.data['origin'] = 'http://asdf'
|
||||
self.analyze()
|
||||
self.assert_failed(with_errors=True)
|
||||
|
||||
def test_origin_path(self):
|
||||
self.data['origin'] = 'app://domain.com/path'
|
||||
self.analyze()
|
||||
self.assert_failed(with_errors=True)
|
||||
|
||||
def test_origin_path_trailing_slash(self):
|
||||
self.data['origin'] = 'app://domain.com/'
|
||||
self.analyze()
|
||||
self.assert_failed(with_errors=True)
|
||||
|
|
Загрузка…
Ссылка в новой задаче