def test_save_and_delete(self): bits = Bits() map_dir_path = os.path.join(bits.gas_dir.path, 'world', 'maps', 'gaspy-unit-test-map') self.assertFalse(os.path.exists(map_dir_path)) m = Map( GasDir(map_dir_path), bits, Map.Data(name='gaspy-unit-test-map', screen_name='GasPy UnitTest Map!')) m.save() self.assertTrue(os.path.exists(map_dir_path)) self.assertTrue(os.path.exists(os.path.join(map_dir_path, 'main.gas'))) m.delete() self.assertFalse(os.path.exists(map_dir_path))
def create_map(name, screen_name): bits = Bits() assert name not in bits.maps m = bits.maps[name] = Map( GasDir(os.path.join(bits.gas_dir.path, 'world', 'maps', name)), bits) data = Map.Data(name, screen_name) data.dev_only = False data.timeofday = '0h0m' data.use_node_mesh_index = True data.use_player_journal = False data.camera.azimuth = 70.0 data.camera.distance = 13.0 data.camera.position = '0,0,0,0x0' m.data = data m.save()