Пример #1
0
    def test_get_post_14041(self, mock_get):
        test_url = 'http://berlinreport.com/bbs/board.php?bo_table=lifeqna&wr_id=52337'
        mock_get.get('http://berlinreport.com/bbs/board.php?bo_table=lifeqna',
                     content=open('news/fixtures/lifeqna.html', 'r').read())
        mock_get.get(test_url,
                     content=open('news/fixtures/event_14041.html', 'r').read())

        load_cmd = Command()
        load_cmd.get_posts(publisher_name='b', url=test_url)
Пример #2
0
    def test_get_post_3954(self, mock_get):
        test_url = 'http://berlinreport.com/bbs/board.php?bo_table=biergarten&wr_id=207141'
        mock_get.get('http://berlinreport.com/bbs/board.php?bo_table=biergarten',
                     content=open('news/fixtures/lifeqna.html', 'r').read())
        mock_get.get(test_url,
                     content=open('news/fixtures/biergarten_3954.html', 'r').read())

        load_cmd = Command()
        load_cmd.get_posts(publisher_name='b', url=test_url)
        art = Post.objects.all()[0]
        self.assertTrue(Post.objects.all().count() > 0)

        self.assertEqual(art.subject, u'독일 카카오톡 정보 공유방 입니다.(끌어 올림)')
Пример #3
0
    def test_get_post_3966(self, mock_get):
        test_url = 'http://berlinreport.com/bbs/board.php?bo_table=biergarten&wr_id=207141'
        mock_get.get('http://berlinreport.com/bbs/board.php?bo_table=biergarten',
                     content=self._read_file('lifeqna'))
        mock_get.get(test_url,
                     content=self._read_file('biergarten_3966'))

        load_cmd = Command()
        load_cmd.get_posts(publisher_name='b', url=test_url)

        art = Post.objects.all()[0]
        self.assertEqual(art.member, u'GregLee')
        self.assertEqual(art.created_at.strftime("%Y-%m-%d %H:%M:%S"),
                         u'2016-04-22 09:45:00')
Пример #4
0
    def test_get_post_52326(self, mock_get):
        test_url = 'http://berlinreport.com/bbs/board.php?bo_table=lifeqna&wr_id=207141'
        mock_get.get('http://berlinreport.com/bbs/board.php?bo_table=lifeqna',
                     content=open('news/fixtures/lifeqna.html', 'r').read())
        mock_get.get(test_url,
                     content=open('news/fixtures/flohmarkt_52326.html', 'r').read())

        load_cmd = Command()
        load_cmd.get_posts(publisher_name='b', url=test_url)

        art = Post.objects.all()[0]
        self.assertTrue(Post.objects.all().count() > 0)
        self.assertEqual(art.category, u'팔자')
        self.assertEqual(art.table_category, u'lifeqna')
        self.assertEqual(art.publisher_category, u'b')

        self.assertTrue(Email.objects.all().count() > 0)
        self.assertFalse(Link.objects.all().count() > 0)
        self.assertTrue(Image.objects.all().count() > 0)