Ejemplo n.º 1
0
 def test_strips_tags(self):
     # Only feeds created with a title get the tags stripped in the title.
     # When using item.set_title() no tags are stripped.
     f1 = Feed(u'http://example.com/1')
     item = Item(fp_values_for_url(u'http://example.com/1/item1', {'title':u"<em>miro</em>"}), feed_id=f1.id)
     self.assertEquals(item.matches_search('miro'), True)
     self.assertEquals(item.matches_search('<em'), False)
     self.assertEquals(item.matches_search('em>'), False)
     self.assertEquals(item.matches_search('<em>miro</miro'), False)
Ejemplo n.º 2
0
 def test_strips_tags(self):
     # Only feeds created with a title get the tags stripped in the title.
     # When using item.set_title() no tags are stripped.
     f1 = Feed(u'http://example.com/1')
     item = Item(fp_values_for_url(u'http://example.com/1/item1',
                                   {'title': u"<em>miro</em>"}),
                 feed_id=f1.id)
     self.assertEquals(item.matches_search('miro'), True)
     self.assertEquals(item.matches_search('<em'), False)
     self.assertEquals(item.matches_search('em>'), False)
     self.assertEquals(item.matches_search('<em>miro</miro'), False)
Ejemplo n.º 3
0
class ItemSearchTest(MiroTestCase):
    def setUp(self):
        MiroTestCase.setUp(self)
        self.feed = Feed(u'http://example.com/1')
        self.item1 = Item(fp_values_for_url(u'http://example.com/1/item1'),
                          feed_id=self.feed.id)
        self.item2 = Item(fp_values_for_url(u'http://example.com/1/item2'),
                          feed_id=self.feed.id)

    def test_matches_search(self):
        self.item1.title = u"miro is cool"
        self.item1.signal_change()
        self.assertEquals(self.item1.matches_search('miro'), True)
        self.assertEquals(self.item1.matches_search('iro'), True)
        self.assertEquals(self.item1.matches_search('c'), True)
        self.assertEquals(self.item1.matches_search('miro is'), True)
        self.assertEquals(self.item1.matches_search('ool m'), True)
        self.assertEquals(self.item1.matches_search('miros'), False)
        self.assertEquals(self.item1.matches_search('iscool'), False)
        self.assertEquals(self.item1.matches_search('cool -miro'), False)

    def test_strips_tags(self):
        # Only feeds created with a title get the tags stripped in the title.
        # When using item.set_title() no tags are stripped.
        f1 = Feed(u'http://example.com/1')
        item = Item(fp_values_for_url(u'http://example.com/1/item1',
                                      {'title': u"<em>miro</em>"}),
                    feed_id=f1.id)
        self.assertEquals(item.matches_search('miro'), True)
        self.assertEquals(item.matches_search('<em'), False)
        self.assertEquals(item.matches_search('em>'), False)
        self.assertEquals(item.matches_search('<em>miro</miro'), False)
Ejemplo n.º 4
0
class ItemSearchTest(MiroTestCase):
    def setUp(self):
        MiroTestCase.setUp(self)
        self.feed = Feed(u'http://example.com/1')
        self.item1 = Item(fp_values_for_url(u'http://example.com/1/item1'),
                feed_id=self.feed.id)
        self.item2 = Item(fp_values_for_url(u'http://example.com/1/item2'),
                feed_id=self.feed.id)

    def test_matches_search(self):
        self.item1.title = u"miro is cool"
        self.item1.signal_change()
        self.assertEquals(self.item1.matches_search('miro'), True)
        self.assertEquals(self.item1.matches_search('iro'), True)
        self.assertEquals(self.item1.matches_search('c'), True)
        self.assertEquals(self.item1.matches_search('miro is'), True)
        self.assertEquals(self.item1.matches_search('ool m'), True)
        self.assertEquals(self.item1.matches_search('miros'), False)
        self.assertEquals(self.item1.matches_search('iscool'), False)
        self.assertEquals(self.item1.matches_search('cool -miro'), False)

    def test_strips_tags(self):
        # Only feeds created with a title get the tags stripped in the title.
        # When using item.set_title() no tags are stripped.
        f1 = Feed(u'http://example.com/1')
        item = Item(fp_values_for_url(u'http://example.com/1/item1', {'title':u"<em>miro</em>"}), feed_id=f1.id)
        self.assertEquals(item.matches_search('miro'), True)
        self.assertEquals(item.matches_search('<em'), False)
        self.assertEquals(item.matches_search('em>'), False)
        self.assertEquals(item.matches_search('<em>miro</miro'), False)
Ejemplo n.º 5
0
class ItemSearchTest(MiroTestCase):
    def setUp(self):
        MiroTestCase.setUp(self)
        self.feed = Feed(u"http://example.com/1")
        self.item1 = Item(fp_values_for_url(u"http://example.com/1/item1"), feed_id=self.feed.id)
        self.item2 = Item(fp_values_for_url(u"http://example.com/1/item2"), feed_id=self.feed.id)

    def test_matches_search(self):
        self.item1.set_title(u"miro is cool")
        self.assertEquals(self.item1.matches_search("miro"), True)
        self.assertEquals(self.item1.matches_search("iro"), True)
        self.assertEquals(self.item1.matches_search("c"), True)
        self.assertEquals(self.item1.matches_search("miro is"), True)
        self.assertEquals(self.item1.matches_search("ool m"), True)
        self.assertEquals(self.item1.matches_search("miros"), False)
        self.assertEquals(self.item1.matches_search("iscool"), False)
        self.assertEquals(self.item1.matches_search("cool -miro"), False)

    def test_strips_tags(self):
        # Only feeds created with a title get the tags stripped in the title.
        # When using item.set_title() no tags are stripped.
        f1 = Feed(u"http://example.com/1")
        item = Item(fp_values_for_url(u"http://example.com/1/item1", {"title": u"<em>miro</em>"}), feed_id=f1.id)
        self.assertEquals(item.matches_search("miro"), True)
        self.assertEquals(item.matches_search("<em"), False)
        self.assertEquals(item.matches_search("em>"), False)
        self.assertEquals(item.matches_search("<em>miro</miro"), False)