Commit 7736fec3 authored by FichteFoll's avatar FichteFoll

Merge pull request #2922 from wbond/test_details

Add tests for the details urls
parents 271824da ca8f534f
......@@ -73,7 +73,7 @@
"releases": [
{
"sublime_text": "*",
"details": "https://github.com/alessandrofac93/FalconSublimeTools/releases/tags"
"details": "https://github.com/alessandrofac93/FalconSublimeTools/tree/master"
}
]
},
......@@ -146,7 +146,7 @@
"releases": [
{
"sublime_text": "*",
"details": "https://github.com/jaabell/fei-syntax-n-snippets/master"
"details": "https://github.com/jaabell/fei-syntax-n-snippets/tree/master"
}
]
},
......
......@@ -99,12 +99,12 @@
},
{
"name": "Ohdeung-eun",
"details": "http://github.com/luavis/Ohdeung-eun",
"details": "https://github.com/luavis/Ohdeung-eun",
"labels": ["Lorem", "lorem", "hangul", "\\uc624\\ub4f1\\uc740"],
"releases": [
{
"sublime_text": "*",
"details": "http://github.com/luavis/Ohdeung-eun/tree/master"
"details": "https://github.com/luavis/Ohdeung-eun/tree/master"
}
]
},
......@@ -308,7 +308,7 @@
"*"
],
"sublime_text": "*",
"details": "https://bitbucket.org/bteryek/openinbrowser/#tags"
"details": "https://bitbucket.org/bteryek/openinbrowser#tags"
}
]
},
......
......@@ -594,7 +594,7 @@
"*"
],
"sublime_text": "*",
"details": "https://bitbucket.org/bteryek/phpcodegen/#tags"
"details": "https://bitbucket.org/bteryek/phpcodegen#tags"
}
]
},
......@@ -807,7 +807,7 @@
},
{
"name": "plist",
"details": "https://bitbucket.org/fschwehn/sublime_plist/overview",
"details": "https://bitbucket.org/fschwehn/sublime_plist",
"labels": ["language syntax"],
"releases": [
{
......
......@@ -133,6 +133,16 @@ class TestContainer(object):
'labels': list
}
d_reg = r'''^ (https:// github\.com/ [^/]+/ [^/]+ (/tree/ .+ (?<!/)
|/tags
|/)?
|https:// bitbucket\.org/ [^/]+/ [^/]+ (/src/ .+ (?<!/)
|\#tags
|/)?
) $'''
# Strip multilines for better debug info on failures
details_regex = re.compile(' '.join(d_reg.split()), re.X)
def _test_repository_keys(self, include, data):
self.assertTrue(2 <= len(data) <= 3, "Unexpected number of keys")
self.assertIn('schema_version', data)
......@@ -182,10 +192,14 @@ class TestContainer(object):
self.assertIn(k, self.package_key_types_map)
self.assertIsInstance(v, self.package_key_types_map[k], k)
if k in ('details', 'homepage', 'readme', 'issues', 'donate',
'buy'):
if k in ('homepage', 'readme', 'issues', 'donate', 'buy'):
self.assertRegex(v, '^https?://')
if k == 'details':
self.assertRegex(v, self.details_regex,
'The details url is badly formatted or '
'invalid')
# Test for invalid characters (on file systems)
if k == 'name':
# Invalid on Windows (and sometimes problematic on UNIX)
......@@ -233,8 +247,13 @@ class TestContainer(object):
if k == 'date':
self.assertRegex(v, r"^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d$")
if k in ('details', 'url'):
self.assertRegex(v, '^https?://')
if k == 'url':
self.assertRegex(v, r'^https?://')
if k == 'details':
self.assertRegex(v, self.details_regex,
'The details url is badly formatted or '
'invalid')
if k == 'sublime_text':
self.assertRegex(v, '^(\*|<=?\d{4}|>=?\d{4})$',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment