mirror of
https://github.com/ai-robots-txt/ai.robots.txt.git
synced 2026-07-16 19:34:31 +02:00
tests.py: consolidate
This commit is contained in:
parent
80357baf9c
commit
ffad9293c4
1 changed files with 17 additions and 1 deletions
|
|
@ -4,7 +4,7 @@
|
|||
import json
|
||||
import unittest
|
||||
|
||||
from robots import json_to_txt, json_to_table, json_to_htaccess, json_to_nginx, json_to_haproxy, json_to_caddy, json_to_lighttpd
|
||||
from robots import json_to_txt, json_to_table, json_to_htaccess, json_to_nginx, json_to_haproxy, json_to_caddy, json_to_lighttpd, consolidate, default_values, default_value
|
||||
|
||||
class RobotsUnittestExtensions:
|
||||
def loadJson(self, pathname):
|
||||
|
|
@ -97,6 +97,22 @@ class TestLighttpdConfigGeneration(unittest.TestCase, RobotsUnittestExtensions):
|
|||
self.assertEqualsFile("test_files/lighttpd-block-ai-bots.conf", robots_lighttpd)
|
||||
|
||||
|
||||
class TestConsolidate(unittest.TestCase, RobotsUnittestExtensions):
|
||||
maxDiff = 8192
|
||||
|
||||
def test_new_item(self):
|
||||
existing = {}
|
||||
self.assertEqual("George Jetson", consolidate(existing, "rosie", "operator", "George Jetson"))
|
||||
|
||||
def test_ignores_defaults(self):
|
||||
existing = {"rosie": { "operator": "George Jetson"}}
|
||||
self.assertEqual("George Jetson", consolidate(existing, "rosie", "operator", default_value))
|
||||
|
||||
def test_new_description(self):
|
||||
existing = {"rosie": { "description": default_value}}
|
||||
self.assertEqual("Rosie is the robot maid from The Jetsons, an American animated sitcom.",
|
||||
consolidate(existing, "rosie", "description", "Rosie is the robot maid from The Jetsons, an American animated sitcom")
|
||||
|
||||
if __name__ == "__main__":
|
||||
import os
|
||||
os.chdir(os.path.dirname(__file__))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue