feat: initial Cutdex application
Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
This commit is contained in:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,82 @@
|
||||
"""Release channel isolation and full update validation regression tests."""
|
||||
import base64
|
||||
from pathlib import Path
|
||||
import plistlib
|
||||
import tempfile
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from macos_updates import configure, validate_url, publish, SPARKLE
|
||||
|
||||
|
||||
class UpdateConfigurationTests(unittest.TestCase):
|
||||
def test_production_rejects_local_feed(self):
|
||||
with self.assertRaises(ValueError):
|
||||
validate_url('http://localhost:8765/appcast.xml')
|
||||
with self.assertRaises(ValueError):
|
||||
validate_url('http://example.com/appcast.xml', local=True)
|
||||
with self.assertRaises(ValueError):
|
||||
validate_url('https://user:password@example.com/appcast.xml')
|
||||
|
||||
def test_local_configuration_is_scoped_to_development(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
app = Path(directory) / 'cutdex.app'
|
||||
(app / 'Contents').mkdir(parents=True)
|
||||
path = app / 'Contents/Info.plist'
|
||||
key = base64.b64encode(bytes(range(32))).decode()
|
||||
original = {'CFBundleIdentifier': 'app.cutdex.desktop'}
|
||||
path.write_bytes(plistlib.dumps(original))
|
||||
with self.assertRaises(ValueError):
|
||||
configure(app, 'http://localhost:8765/appcast.xml', key, local=True)
|
||||
self.assertEqual(plistlib.loads(path.read_bytes()), original)
|
||||
original['CFBundleIdentifier'] += '.dev'
|
||||
path.write_bytes(plistlib.dumps(original))
|
||||
configure(app, 'http://localhost:8765/appcast.xml', key, local=True)
|
||||
info = plistlib.loads(path.read_bytes())
|
||||
self.assertFalse(info['SUAllowsAutomaticUpdates'])
|
||||
self.assertFalse(info['SUEnableAutomaticChecks'])
|
||||
self.assertNotIn('NSAllowsArbitraryLoads', info['NSAppTransportSecurity'])
|
||||
self.assertEqual(set(info['NSAppTransportSecurity']['NSExceptionDomains']), {'localhost'})
|
||||
|
||||
def test_invalid_public_key_does_not_change_app(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
app = Path(directory)
|
||||
(app / 'Contents').mkdir()
|
||||
path = app / 'Contents/Info.plist'
|
||||
original = plistlib.dumps({'CFBundleIdentifier': 'app.cutdex.desktop'})
|
||||
path.write_bytes(original)
|
||||
with self.assertRaises(ValueError):
|
||||
configure(app, 'https://updates.example.com/appcast.xml', 'YQ==')
|
||||
self.assertEqual(path.read_bytes(), original)
|
||||
|
||||
|
||||
class PublicationVersionTests(unittest.TestCase):
|
||||
def test_older_or_equivalent_build_cannot_replace_current_feed(self):
|
||||
for current, candidate in [('900002', '900001'), ('2', '2.0'), ('2.10', '2.9')]:
|
||||
with self.subTest(current=current, candidate=candidate), tempfile.TemporaryDirectory() as directory:
|
||||
output = Path(directory)
|
||||
feed = output / 'appcast.xml'
|
||||
original = (f'<rss xmlns:sparkle="{SPARKLE}"><channel><item>'
|
||||
f'<sparkle:version>{current}</sparkle:version>'
|
||||
'</item></channel></rss>').encode()
|
||||
feed.write_bytes(original)
|
||||
def generate(command, **kwargs):
|
||||
if command[0] == 'ditto':
|
||||
Path(command[-1]).write_bytes(b'archive')
|
||||
else:
|
||||
Path(command[command.index('-o') + 1]).write_text(
|
||||
f'<rss xmlns:sparkle="{SPARKLE}"><channel><item>'
|
||||
f'<sparkle:version>{candidate}</sparkle:version>'
|
||||
'<enclosure sparkle:edSignature="test-signature"/>'
|
||||
'</item></channel></rss>')
|
||||
with patch('macos_updates.validate_app', return_value={'CFBundleVersion': candidate}), \
|
||||
patch('macos_updates.subprocess.run', side_effect=generate) as run:
|
||||
with self.assertRaisesRegex(ValueError, 'newer'):
|
||||
publish(Path('app'), output, 'https://example.com/', Path('tools'))
|
||||
run.assert_not_called()
|
||||
self.assertEqual(feed.read_bytes(), original)
|
||||
self.assertEqual(list(output.glob('*.zip')), [])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user