883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
84 lines
4.8 KiB
Python
84 lines
4.8 KiB
Python
import sys
|
|
from pathlib import Path
|
|
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
|
|
from native_test_guard import require_authenticated_turtle_realm,require_local_turtle_ports,require_native_world_observation,require_native_gameplay_policy
|
|
|
|
require_native_gameplay_policy({'enabled':True,'error':0})
|
|
for invalid in ({},{'enabled':False,'error':0},{'enabled':True,'error':7}):
|
|
try:require_native_gameplay_policy(invalid)
|
|
except RuntimeError:pass
|
|
else:raise AssertionError('Disabled or failed native send policy must reject gameplay input')
|
|
|
|
require_local_turtle_ports({3724,8090,8085})
|
|
try:require_local_turtle_ports({3724,8090,19085})
|
|
except RuntimeError:pass
|
|
else:raise AssertionError('gateway must be absent')
|
|
try:require_local_turtle_ports({3724,8085})
|
|
except RuntimeError:pass
|
|
else:raise AssertionError('Tortoise world service must be present')
|
|
account={'server_proof_verified':1,'transport_prepared':1,'auth_port':3724,'selected_index':0,
|
|
'realms':[{'address':'127.0.0.1:8090'}]}
|
|
require_authenticated_turtle_realm(account)
|
|
for changed in ({'auth_port':8085},{'realms':[{'address':'127.0.0.1:8085'}]},
|
|
{'server_proof_verified':0},{'transport_prepared':0}):
|
|
candidate=dict(account,**changed)
|
|
try:require_authenticated_turtle_realm(candidate)
|
|
except RuntimeError:pass
|
|
else:raise AssertionError('non-Turtle session accepted: '+repr(changed))
|
|
print('Native tests enforce the authenticated local Tortoise realm and stopped gateway while preserving unrelated listeners.')
|
|
|
|
pipe={'error':0,'closed':0,'world_auth':1,'world':{'login_sent':1,'self_create':1}}
|
|
engine={'netclient':{'state_enum':5,'packet_host':{'self_create_consumed':True}}}
|
|
for state in ('world','loading-or-unknown'):
|
|
require_native_world_observation(pipe,engine,state)
|
|
for state in ('login','disconnected','characters','ruleset'):
|
|
try:require_native_world_observation(pipe,engine,state)
|
|
except RuntimeError:pass
|
|
else:raise AssertionError('Known non-world UI must reject observation')
|
|
for invalid in ({},dict(pipe,error=23),dict(pipe,closed=1),dict(pipe,world_auth=0),dict(pipe,world={'login_sent':1,'self_create':0})):
|
|
try:require_native_world_observation(invalid,engine,'loading-or-unknown')
|
|
except RuntimeError:pass
|
|
else:raise AssertionError('Unavailable/failed pipe must reject observation')
|
|
for invalid in ({},{'netclient':{'state_enum':5}},{'netclient':{'state_enum':4,'packet_host':{'self_create_consumed':True}}}):
|
|
try:require_native_world_observation(pipe,invalid,'loading-or-unknown')
|
|
except RuntimeError:pass
|
|
else:raise AssertionError('Queued-only or missing self-create consumption is insufficient')
|
|
print('Read-only native observation requires live world auth and actual engine self-create consumption; known non-world UI remains rejected.')
|
|
|
|
from native_test_guard import require_solo_test_character
|
|
require_solo_test_character(4509,'4509\n')
|
|
for value,rows in ((4509,''),(4509,'4508'),(4509,'4509\n4510'),(True,'1'),(0,'0'),(4509,None)):
|
|
try:require_solo_test_character(value,rows)
|
|
except RuntimeError:pass
|
|
else:raise AssertionError('Wrong/multiple local character fixture accepted')
|
|
print('Sole source-online test identity guard rejects wrong or unrelated active characters.')
|
|
|
|
from native_test_guard import expected_gm_restore_auras
|
|
assert expected_gm_restore_auras('2457',55)=='2457\n16380'
|
|
assert expected_gm_restore_auras('2457\n16380',55)=='2457\n16380'
|
|
assert expected_gm_restore_auras('2457',0)=='2457'
|
|
assert expected_gm_restore_auras('2457\n2457',55)=='2457\n2457\n16380'
|
|
assert expected_gm_restore_auras('2457',55)!='2457\n3150\n16380'
|
|
for rows,flags in ((None,55),('0',55),('2457 junk',55),('2457',-1)):
|
|
try:expected_gm_restore_auras(rows,flags)
|
|
except RuntimeError:pass
|
|
else:raise AssertionError('Malformed saved aura restoration accepted')
|
|
print('GM restore permits only legitimate source visual16380 addition; unrelated effects remain visible.')
|
|
|
|
from native_test_guard import require_supported_pve_creature
|
|
for cls in (0,1,2,4,8):
|
|
assert require_supported_pve_creature(f'Local Creature\t59\t60\t0\t0\t{cls}',60)[-1]==str(cls)
|
|
assert require_supported_pve_creature('Expert Training Dummy\t60\t60\t0\t0\t0',60)[-1]=='0'
|
|
for row in ('Local Creature\t60\t60\t0\t0\t9',
|
|
'Local Creature\t59\t60\t1\t0\t1',
|
|
'Local Creature\t59\t60\t0\t128\t1',
|
|
'Local Creature\t57\t60\t0\t0\t1',
|
|
'Local Creature\t60\t61\t0\t0\t1',
|
|
'Local Creature\t59\t60\t0\t0',
|
|
'Local Creature\t59\t60\t0\t0\t1\nExtra',
|
|
'Local Creature\t59\t60\t0\t0\t-1'):
|
|
try:require_supported_pve_creature(row,60)
|
|
except RuntimeError:pass
|
|
else:raise AssertionError('Unsupported source fixture accepted before summoning')
|
|
print('Matched PvE fixtures reject unsupported native creature classes before any source-state modification.')
|