add a test script

This commit is contained in:
Romain Bignon 2012-07-12 11:33:47 +02:00
commit ddcf9ffb0e
5 changed files with 52 additions and 19 deletions

View file

@ -82,23 +82,23 @@ class DetailsPage(BasePage):
for div in divs:
detail = Detail()
detail.label = div.find('div[@class="titreDetail"]/p').text_content()
detail.label = unicode(div.find('div[@class="titreDetail"]/p').text_content())
if inter:
detail.label = detail.label + " (international)"
detail.infos = div.find('div[@class="consoDetail"]/p').text_content().lstrip()
detail.label = detail.label + u" (international)"
detail.infos = unicode(div.find('div[@class="consoDetail"]/p').text_content().lstrip())
detail.price = convert_price(div)
self.details.append(detail)
def parse_voice(self, div, string, inter=False):
voice = Detail()
voice.label = div.find('div[@class="titreDetail"]/p').text_content()
voice.label = unicode(div.find('div[@class="titreDetail"]/p').text_content())
if inter:
voice.label = voice.label + " (international)"
voice.price = convert_price(div)
voice1 = div.xpath('div[@class="consoDetail"]/p/span')[0].text
voice2 = div.xpath('div[@class="consoDetail"]/p/span')[1].text
voice.infos = string % (voice1, voice2)
voice.infos = unicode(string) % (voice1, voice2)
return voice

View file

@ -31,11 +31,11 @@ class HomePage(BasePage):
def get_list(self):
l = []
divabo = self.document.xpath('//div[@class="idAbonne pointer"]')[0]
owner = divabo.xpath('p')[0].text.replace(' - ', '')
phone = divabo.xpath('p/span')[0].text
owner = unicode(divabo.xpath('p')[0].text.replace(' - ', ''))
phone = unicode(divabo.xpath('p/span')[0].text)
self.browser.logger.debug('Found ' + owner + ' has subscriber')
self.browser.logger.debug('Found ' + phone + ' has phone number')
phoneplan = self.document.xpath('//div[@class="forfaitChoisi"]')[0].text.lstrip().rstrip()
phoneplan = unicode(self.document.xpath('//div[@class="forfaitChoisi"]')[0].text.lstrip().rstrip())
self.browser.logger.debug('Found ' + phoneplan + ' has subscription type')
subscription = Subscription(phone)