示例#1
0
    def setUp(self):
        # Disable logging to the console
        logging.disable(logging.CRITICAL + 1)

        self.cond = threading.Condition()
        self.server = FeedParserTestServer(self.cond)
        self.cond.acquire()
        self.server.start()

        # Wait until the server is ready
        while not self.server.ready:
            # Collect left over servers so they release their
            # sockets
            import gc
            gc.collect()
            self.cond.wait()

        self.cond.release()
示例#2
0
class FeedCreateTest(DjangoTestCase):
    fixtures = ["base.json"]

    def setUp(self):
        # Disable logging to the console
        logging.disable(logging.CRITICAL+1)

        self.cond = threading.Condition()
        self.server = FeedParserTestServer(self.cond) 
        self.cond.acquire()
        self.server.start()

        # Wait until the server is ready
        while not self.server.ready:
            # Collect left over servers so they release their
            # sockets
            import gc
            gc.collect()
            self.cond.wait()

        self.cond.release()

    def tearDown(self):
        self.server = None
        stop_server(PORT)

    def test_bad_xml(self):
        form = FeedCreationForm({
            'lifestream': 1,
            'url': 'http://127.0.0.1:8097/feeds/rss/bad_xml.xml',
            'plugin_class_name': '',
        })
        self.assertTrue(form.is_valid())

    def test_no_title(self):
        form = FeedCreationForm({
            'lifestream': 1,
            'url': 'http://127.0.0.1:8097/feeds/rss/no_title.xml',
            'plugin_class_name': '',
        })
        self.assertTrue(not form.is_valid())
        self.assertTrue('url' in form.errors)
示例#3
0
class FeedCreateTest(DjangoTestCase):
    fixtures = ["base.json"]

    def setUp(self):
        # Disable logging to the console
        logging.disable(logging.CRITICAL + 1)

        self.cond = threading.Condition()
        self.server = FeedParserTestServer(self.cond)
        self.cond.acquire()
        self.server.start()

        # Wait until the server is ready
        while not self.server.ready:
            # Collect left over servers so they release their
            # sockets
            import gc
            gc.collect()
            self.cond.wait()

        self.cond.release()

    def tearDown(self):
        self.server = None
        stop_server(PORT)

    def test_bad_xml(self):
        form = FeedCreationForm({
            'lifestream': 1,
            'url': 'http://127.0.0.1:8097/feeds/rss/bad_xml.xml',
            'plugin_class_name': '',
        })
        self.assertTrue(form.is_valid())

    def test_no_title(self):
        form = FeedCreationForm({
            'lifestream': 1,
            'url': 'http://127.0.0.1:8097/feeds/rss/no_title.xml',
            'plugin_class_name': '',
        })
        self.assertTrue(not form.is_valid())
        self.assertTrue('url' in form.errors)
示例#4
0
    def setUp(self):
        # Disable logging to the console
        logging.disable(logging.CRITICAL+1)

        self.cond = threading.Condition()
        self.server = FeedParserTestServer(self.cond) 
        self.cond.acquire()
        self.server.start()

        # Wait until the server is ready
        while not self.server.ready:
            # Collect left over servers so they release their
            # sockets
            import gc
            gc.collect()
            self.cond.wait()

        self.cond.release()