Initial Alpine security mirror

This commit is contained in:
root
2026-11-10 22:08:53 +01:00
commit 2b662f7b42
9 changed files with 298 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import json,unittest,sys
from pathlib import Path
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'scripts'))
import sync
class MirrorTests(unittest.TestCase):
def test_release_discovery(self):
html=b'<a href="v3.4/">old</a><a href="v3.5/">v3.5</a><a href="v3.24/">new</a><a href="edge/">edge</a>'
self.assertEqual(sync.release_links(html,5),['v3.5','v3.24','edge'])
def test_file_names(self):
h=b'<a href="main.json">main</a><a href="community.json">community</a><a href="main.yaml">main yaml</a>'
self.assertEqual(sync.available_files(h),['community.json','main.json'])
def test_validate(self):
self.assertEqual(sync.validate_json(json.dumps({'packages':[{'pkg':{}}]}).encode()),1)
with self.assertRaises(ValueError): sync.validate_json(b'{}')
if __name__=='__main__':unittest.main()