Esempio n. 1
0
    def test_root(self):
        # without login
        context = nightcrawler.Context('/')
        result = Provider().navigate(context)
        self.assertEquals(len(result), 2)  # 50 + next page

        # with login
        context = nightcrawler.Context('/')
        settings = context.get_settings()
        settings.set_string(settings.LOGIN_USERNAME, self.USERNAME)
        settings.set_string(settings.LOGIN_PASSWORD, self.PASSWORD)
        result = Provider().navigate(context)
        self.assertEquals(len(result), 4)  # 50 + next page

        # with false login
        context = nightcrawler.Context('/')
        settings = context.get_settings()
        settings.set_string(settings.LOGIN_USERNAME, self.USERNAME)
        settings.set_string(settings.LOGIN_PASSWORD, 'fail')
        nightcrawler.run(Provider(), context)
        pass
    def test_root(self):
        # without login
        context = nightcrawler.Context("/")
        result = Provider().navigate(context)
        self.assertEquals(len(result), 2)  # 50 + next page

        # with login
        context = nightcrawler.Context("/")
        settings = context.get_settings()
        settings.set_string(settings.LOGIN_USERNAME, self.USERNAME)
        settings.set_string(settings.LOGIN_PASSWORD, self.PASSWORD)
        result = Provider().navigate(context)
        self.assertEquals(len(result), 4)  # 50 + next page

        # with false login
        context = nightcrawler.Context("/")
        settings = context.get_settings()
        settings.set_string(settings.LOGIN_USERNAME, self.USERNAME)
        settings.set_string(settings.LOGIN_PASSWORD, "fail")
        nightcrawler.run(Provider(), context)
        pass
Esempio n. 3
0
__author__ = 'bromix'

from resources.lib import nightcrawler
from resources.lib import content

nightcrawler.run(content.Provider())