feat: add CH5 cube renewal presentation, trade level UI, audit manifests, and test fixtures
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
||||
import quiver_assets as q
|
||||
|
||||
|
||||
class QuiverAssetTests(unittest.TestCase):
|
||||
def test_relative_windows_paths_and_cycles(self):
|
||||
files = {'d:/ymir work/pc/assassin/bow/' + n: b'' for n in q.MOTIONS}
|
||||
files.update({'d:/ymir work/pc2/assassin/bow/' + n: b'' for n in q.MOTIONS})
|
||||
special = 'd:/ymir work/pc/assassin/bow/attack_special.msa'
|
||||
raw = b'MotionFileName "attack.gr2"\nEffect "d:\\ymir work\\pc\\assassin\\effect\\arrow_02.msf"'
|
||||
files['d:/ymir work/pc/assassin/bow/attack.gr2'] = b'existing-model'
|
||||
files['d:/ymir work/pc/assassin/effect/arrow_02.msf'] = b'Effect "../bow/attack_special.msa"'
|
||||
del files[special]
|
||||
missing, records = q.collect(files.get, lambda p: raw if p == special else None)
|
||||
self.assertEqual(missing, {special: raw})
|
||||
self.assertEqual(len(records), 20)
|
||||
self.assertEqual(records[special]['origin'], 'ava2_reference')
|
||||
|
||||
def test_current_artwork_is_never_overridden(self):
|
||||
def reference(p):
|
||||
raise AssertionError('should not consult reference')
|
||||
missing, records = q.collect(lambda p: b'current', reference)
|
||||
self.assertEqual(missing, {})
|
||||
self.assertEqual(len(records), 18)
|
||||
|
||||
def test_missing_dependency_rejects(self):
|
||||
with self.assertRaisesRegex(ValueError, 'missing quiver dependency'):
|
||||
q.collect(lambda p: None, lambda p: None)
|
||||
|
||||
def test_path_escape_rejects(self):
|
||||
for raw in [b'"../../../../../private.tga"', b'"e:/private.tga"']:
|
||||
with self.assertRaises(ValueError):
|
||||
q.dependencies('d:/ymir work/pc/assassin/bow/attack_special.msa', raw)
|
||||
|
||||
def test_closure_limit(self):
|
||||
with self.assertRaisesRegex(ValueError, 'exceeds limit'):
|
||||
q.collect(lambda p: b'', lambda p: None, maximum=1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user