fix login

This commit is contained in:
Romain Bignon 2011-07-02 13:22:38 +02:00
commit 0985ab7062
2 changed files with 8 additions and 2 deletions

View file

@ -103,10 +103,10 @@ class AuMBrowser(BaseBrowser):
self.page.login(self.username, self.password) self.page.login(self.username, self.password)
def is_logged(self): def is_logged(self):
return not self.is_on_page(LoginPage) return self.page and self.page.is_logged()
def home(self): def home(self):
return self.location('http://www.adopteunmec.com/') return self.location('http://www.adopteunmec.com/index.php')
def pageaccess(func): def pageaccess(func):
def inner(self, *args, **kwargs): def inner(self, *args, **kwargs):

View file

@ -37,6 +37,12 @@ class PageBase(BasePage):
if img.getAttribute('src') == 'http://s.adopteunmec.com/img/exemple.jpg': if img.getAttribute('src') == 'http://s.adopteunmec.com/img/exemple.jpg':
raise AdopteBanned('Your account is blocked. You have to unblock by yourself but we can\'t help you.') raise AdopteBanned('Your account is blocked. You have to unblock by yourself but we can\'t help you.')
def is_logged(self):
for form in self.browser.forms():
if form.name == 'form_login':
return False
return True
def open_contact_list_page(self): def open_contact_list_page(self):
self.browser.follow_link(url_regex=r"/mail.php$") self.browser.follow_link(url_regex=r"/mail.php$")