# ContentDB # Copyright (C) rubenwardy # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . from app.utils.minetest_hypertext import html_to_minetest conquer_html = """

Welcome to Conquer, a mod that adds RTS gameplay. It allows players to start Conquer sub-games, where they can place buildings, train units, and fight other players.

Starting or joining a session

You can list running sessions by typing:

/conquer list
new line

another new line

You'll switch into Conquer playing mode, where you will be given buildings that you can place. You'll need to place a keep, which you must protect at all costs.

You may leave a game and return to normal playing mode at anytime by typing:

Conquer GUI

The Conquer GUI is the central place for monitoring your kingdom. Once in a session, you can view it by pressing the inventory key (I), or by punching/right-clicking the keep node.

""" conquer_expected = """ Welcome to Conquer, a mod that adds RTS gameplay. It allows players to start Conquer sub-games, where they can place buildings, train units, and fight other players. Starting or joining a session You can list running sessions by typing: /conquer list new line another new line You'll switch into Conquer playing mode, where you will be given buildings that you can place. You'll need to place a keep, which you must protect at all costs. You may leave a game and return to normal playing mode at anytime by typing: Conquer GUI The Conquer GUI is the central place for monitoring your kingdom. Once in a session, you can view it by pressing the inventory key (I), or by punching/right-clicking the keep node. """ def test_conquer(): assert html_to_minetest(conquer_html)["body"].strip() == conquer_expected.strip() def test_images(): html = """ """ expected = "" result = html_to_minetest(html) assert result["body"].strip() == expected.strip() assert len(result["images"]) == 1 assert result["images"]["image_0"] == "/path/to/img.png" def test_bullets(): html = """ """ expected = "• One\n" \ "• two three\n" \ "• sub one\n" \ "• sub two\n\n" \ "• four\n" result = html_to_minetest(html) assert result["body"].strip() == expected.strip() def test_inline(): html = """ One two three """ expected = "One two three" result = html_to_minetest(html) assert result["body"].strip() == expected.strip()