Пример #1
0
class TestsParser(unittest.TestCase):
    def setUp(self):
        self.parser1 = Parser("x5")
        self.parser2 = Parser("x1")
        self.parser = Parser("x5")
        self.parser.url = "file:///D:/C/x5.htm"

    def test_create(self):
        self.assertIsNotNone(self.parser)

    def test_params(self):
        self.assertEqual(self.parser1.url,
                         "http://www.l2planet.ws/?go=online&server=x5")
        self.assertEqual(self.parser2.url,
                         "http://www.l2planet.ws/?go=online&server=x1")
        self.assertEqual(self.parser.pause, 5)
        self.assertEqual(
            self.parser.headers,
            {"User-Agent": "Mozilla/4.0 (compatible; MSIE 7; WindowsNT)"})

    def test_get_content(self):
        self.assertIn("<body>", self.parser.get_content())

    @unittest.skip("WTF?")
    def test_parse(self):
        result = self.parser.parse()
        profile = str({
            'clan': db.Clan(name="DwarfsInc"),
            'profa': db.Profession(name="Doombringer"),
            'name': db.Player(name="NOD")
        })
Пример #2
0
class TestsParser(unittest.TestCase):

    def setUp(self):
        self.parser1 = Parser("x5")
        self.parser2 = Parser("x1")
        self.parser = Parser("x5")
        self.parser.url = "file:///D:/C/x5.htm"

    def test_create(self):
        self.assertIsNotNone(self.parser)

    def test_params(self):
        self.assertEqual(self.parser1.url,
            "http://www.l2planet.ws/?go=online&server=x5")
        self.assertEqual(self.parser2.url,
            "http://www.l2planet.ws/?go=online&server=x1")
        self.assertEqual(self.parser.pause, 5)
        self.assertEqual(self.parser.headers,
                {"User-Agent": "Mozilla/4.0 (compatible; MSIE 7; WindowsNT)"})

    def test_get_content(self):
        self.assertIn("<body>", self.parser.get_content())

    @unittest.skip("WTF?")
    def test_parse(self):
        result = self.parser.parse()
        profile = str({'clan': db.Clan(name="DwarfsInc"),
                       'profa': db.Profession(name="Doombringer"),
                       'name': db.Player(name="NOD")})
Пример #3
0
 def start(self,message):
     NakLogger.debug("Engine here, message from " + self.entryInterface.getInterfaceName() + " - \"" + message + "\" received!")
     wordList = Parser.parser(message)
     #Knifer
     #Meaner
     #  | - Conversation
     #  | - Context
     #AnswerMaker
     answer = "Ok"
     self.entryInterface.outCom(answer)
Пример #4
0
 def setUp(self):
     self.parser1 = Parser("x5")
     self.parser2 = Parser("x1")
     self.parser = Parser("x5")
     self.parser.url = "file:///D:/C/x5.htm"
Пример #5
0
 def setUp(self):
     self.parser1 = Parser("x5")
     self.parser2 = Parser("x1")
     self.parser = Parser("x5")
     self.parser.url = "file:///D:/C/x5.htm"