equal
deleted
inserted
replaced
50 with self.temporary_appobjects(AParser): |
50 with self.temporary_appobjects(AParser): |
51 if u'ô myfeed' in self.repo.sources_by_uri: |
51 if u'ô myfeed' in self.repo.sources_by_uri: |
52 yield self.repo.sources_by_uri[u'ô myfeed']._get_parser(session) |
52 yield self.repo.sources_by_uri[u'ô myfeed']._get_parser(session) |
53 else: |
53 else: |
54 yield |
54 yield |
|
55 # vreg.unregister just pops appobjects from their regid entry, |
|
56 # completely remove the entry to ensure we have no side effect with |
|
57 # this empty entry. |
|
58 del self.vreg['parsers'][AParser.__regid__] |
55 |
59 |
56 def test(self): |
60 def test(self): |
57 self.assertIn(u'ô myfeed', self.repo.sources_by_uri) |
61 self.assertIn(u'ô myfeed', self.repo.sources_by_uri) |
58 dfsource = self.repo.sources_by_uri[u'ô myfeed'] |
62 dfsource = self.repo.sources_by_uri[u'ô myfeed'] |
59 self.assertNotIn('use_cwuri_as_url', dfsource.__dict__) |
63 self.assertNotIn('use_cwuri_as_url', dfsource.__dict__) |
148 cnx.entity_from_eid(dfsource.eid).cw_set(url=u"http://pouet.com\nhttp://pouet.org") |
152 cnx.entity_from_eid(dfsource.eid).cw_set(url=u"http://pouet.com\nhttp://pouet.org") |
149 self.assertEqual(dfsource.urls, [u'ignored']) |
153 self.assertEqual(dfsource.urls, [u'ignored']) |
150 cnx.commit() |
154 cnx.commit() |
151 self.assertEqual(dfsource.urls, [u"http://pouet.com", u"http://pouet.org"]) |
155 self.assertEqual(dfsource.urls, [u"http://pouet.com", u"http://pouet.org"]) |
152 |
156 |
|
157 def test_parser_not_found(self): |
|
158 dfsource = self.repo.sources_by_uri[u'ô myfeed'] |
|
159 with self.assertLogs('cubicweb.sources.o myfeed', level='ERROR') as cm: |
|
160 with self.repo.internal_cnx() as cnx: |
|
161 stats = dfsource.pull_data(cnx, force=True) |
|
162 importlog = cnx.find('CWDataImport').one().log |
|
163 self.assertIn('failed to load parser for', cm.output[0]) |
|
164 self.assertEqual(stats, {}) |
|
165 self.assertIn(u'failed to load parser for source "ô myfeed"', |
|
166 importlog) |
|
167 |
153 |
168 |
154 class DataFeedConfigTC(CubicWebTC): |
169 class DataFeedConfigTC(CubicWebTC): |
155 |
170 |
156 def test_use_cwuri_as_url_override(self): |
171 def test_use_cwuri_as_url_override(self): |
157 with self.admin_access.client_cnx() as cnx: |
172 with self.admin_access.client_cnx() as cnx: |