[monster] improve page parsing
This commit is contained in:
parent
98b70d1eac
commit
4d59d1f9ea
2 changed files with 5 additions and 5 deletions
|
|
@ -71,8 +71,8 @@ class AdvertPage(HTMLPage):
|
||||||
|
|
||||||
obj_id = Env('_id')
|
obj_id = Env('_id')
|
||||||
obj_url = BrowserURL('advert', _id=Env('_id'))
|
obj_url = BrowserURL('advert', _id=Env('_id'))
|
||||||
obj_title = CleanText('//div[@id="jobcopy"]/h1[@itemprop="title"]')
|
obj_title = CleanText('//div[@id="jobcopy"]/h1[@itemprop="title"]|//div[@itemprop="title"]/h1')
|
||||||
obj_description = CleanHTML('//div[@id="jobBodyContent"]')
|
obj_description = CleanHTML('//div[@id="jobBodyContent"]|//div[@itemprop="description"]')
|
||||||
obj_contract_type = Join('%s ', '//dd[starts-with(@class, "multipledd")]')
|
obj_contract_type = Join('%s ', '//dd[starts-with(@class, "multipledd")]')
|
||||||
obj_society_name = CleanText('//dd[@itemprop="hiringOrganization"]')
|
obj_society_name = CleanText('//dd[@itemprop="hiringOrganization"]')
|
||||||
obj_place = CleanText('//span[@itemprop="jobLocation"]')
|
obj_place = CleanText('//span[@itemprop="jobLocation"]')
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import itertools
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -25,13 +25,13 @@ class MonsterTest(BackendTest):
|
||||||
MODULE = 'monster'
|
MODULE = 'monster'
|
||||||
|
|
||||||
def test_monster_search(self):
|
def test_monster_search(self):
|
||||||
l = list(self.backend.search_job(u'marketing'))
|
l = list(itertools.islice(self.backend.search_job(u'marketing'), 0, 20))
|
||||||
assert len(l)
|
assert len(l)
|
||||||
advert = self.backend.get_job_advert(l[0].id, None)
|
advert = self.backend.get_job_advert(l[0].id, None)
|
||||||
self.assertTrue(advert.url, 'URL for announce "%s" not found: %s' % (advert.id, advert.url))
|
self.assertTrue(advert.url, 'URL for announce "%s" not found: %s' % (advert.id, advert.url))
|
||||||
|
|
||||||
def test_monster_advanced_search(self):
|
def test_monster_advanced_search(self):
|
||||||
l = list(self.backend.advanced_search_job())
|
l = list(itertools.islice(self.backend.advanced_search_job(), 0, 20))
|
||||||
assert len(l)
|
assert len(l)
|
||||||
advert = self.backend.get_job_advert(l[0].id, None)
|
advert = self.backend.get_job_advert(l[0].id, None)
|
||||||
self.assertTrue(advert.url, 'URL for announce "%s" not found: %s' % (advert.id, advert.url))
|
self.assertTrue(advert.url, 'URL for announce "%s" not found: %s' % (advert.id, advert.url))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue