예제 #1
0
 def test_prev(self, requests_mock):
     requests_mock.get(WEBSITE)
     requests_mock.get(WEBSITE2)
     session = HTTPSession()
     session.goto(WEBSITE)
     session.goto(WEBSITE2)
     assert session.prev().host == WEBSITE
예제 #2
0
 def test_follow(self, requests_mock):
     requests_mock.get(WEBSITE,
                       status_code=301,
                       headers={"Location": WEBSITE2})
     requests_mock.get(WEBSITE2)
     session = HTTPSession()
     session.goto(WEBSITE)
     session.follow()
     assert session.host == WEBSITE2
예제 #3
0
 def test_goin(self, requests_mock):
     #: http://test.com/parent/child
     fullurl = "".join([WEBSITE, PARENTPATH, CHILDPATH])
     #: http://test.com/parent
     parenturl = "".join([WEBSITE, PARENTPATH])
     requests_mock.get(WEBSITE)
     requests_mock.get(parenturl)
     requests_mock.get(fullurl)
     session = HTTPSession()
     session.goto(WEBSITE)
     # Test goin from root
     assert session.goin(PARENTPATH).path == PARENTPATH
     # Test goin from parent
     assert session.goin(CHILDPATH).path == "".join([PARENTPATH, CHILDPATH])
예제 #4
0
 def test_goout(self, requests_mock):
     #: http://test.com/parent/child
     fullurl = "".join([WEBSITE, PARENTPATH, CHILDPATH])
     #: http://test.com/parent
     parenturl = "".join([WEBSITE, PARENTPATH])
     requests_mock.get(WEBSITE)
     requests_mock.get(fullurl)
     requests_mock.get(parenturl)
     session = HTTPSession()
     session.goto(fullurl)
     assert session.goout().path == PARENTPATH
     # Test goout to root
     assert session.goout().path == "/"
     # Test goout to root when already in root
     assert session.goout().path == "/"
예제 #5
0
 def test_goto(self, requests_mock):
     requests_mock.get(WEBSITE)
     session = HTTPSession()
     session.goto(WEBSITE)
     assert session.page.isok and session.host == WEBSITE