plugins/tools/test_plugin_paper_antixray.py
unimatrixgit 70fadcc297
Some checks failed
Server Housekeeping Build / housekeeping (push) Successful in 1m7s
DuneRealms Plugin CI / plugins (push) Has been cancelled
Add hourly floor-item cleanup and world-scoped Paper Anti-Xray
2026-12-03 22:35:19 +01:00

32 lines
1.4 KiB
Python

import unittest
from plugin_paper_antixray import profile, render
class AntiXrayTests(unittest.TestCase):
def test_planet_only_protects_its_mined_palette(self):
height, hidden = profile("sigma_draconis_iv", "overworld")
self.assertEqual(height, 320)
self.assertIn("deepslate_diamond_ore", hidden)
self.assertIn("raw_copper_block", hidden)
self.assertNotIn("lapis_ore", hidden)
def test_giedi_nether_is_distinct_and_end_and_lobby_are_out_of_scope(self):
self.assertEqual(profile("giedi_prime", "the_nether"),
(128, ("ancient_debris", "nether_gold_ore", "nether_quartz_ore")))
for world in (("lobby", "overworld"), ("sigma_draconis_iv", "the_end"), ("caladan", "the_nether")):
with self.assertRaises(ValueError):
profile(*world)
def test_stage_preserves_unrelated_lines_and_rejects_an_existing_override(self):
original = b"# paper\r\n_version: 30\r\nanticheat: # keep\r\n redstone: true\r\n"
staged = render(original, "arrakis", "overworld")
self.assertTrue(staged.startswith(b"# paper\r\n_version: 30\r\nanticheat: # keep\r\n"))
self.assertTrue(staged.endswith(b" redstone: true\r\n"))
self.assertIn(b" - emerald_ore\r\n", staged)
with self.assertRaisesRegex(ValueError, "Existing anti-xray override"):
render(staged, "arrakis", "overworld")
if __name__ == "__main__":
unittest.main()