Ejemplo n.º 1
0
    def create_ambiguous_record_with_questions(
        record=JohnDoe.RECORD_WITH_CLOSED_CASES,
        cases={
            "X0001": CaseDetails.case_x(),
            "X0002": CaseDetails.case_x(),
            "X0003": CaseDetails.case_x()
        },
    ) -> Tuple[Record, AmbiguousRecord, Dict[str, Question], List[str]]:
        base_url = "https://publicaccess.courts.oregon.gov/PublicAccessLogin/"
        with requests_mock.Mocker() as m:
            m.post(URL.login_url(), text=PostLoginPage.POST_LOGIN_PAGE)

            m.post("{}{}".format(base_url, "Search.aspx?ID=100"),
                   [{
                       "text": SearchPageResponse.RESPONSE
                   }, {
                       "text": record
                   }])

            for key, value in cases.items():
                m.get("{}{}{}".format(base_url, "CaseDetail.aspx?CaseID=",
                                      key),
                      text=value)

            aliases = (Alias(first_name="John",
                             last_name="Doe",
                             middle_name="",
                             birth_date=""), )
            return RecordCreator.build_record(
                RecordCreator.build_search_results.__wrapped__, "username",
                "password", aliases, {})
Ejemplo n.º 2
0
    def setup():
        crawler = Crawler()
        with requests_mock.Mocker() as m:
            m.post(URL.login_url(), text=PostLoginPage.POST_LOGIN_PAGE)
            crawler.login("username", "password")

        return crawler
Ejemplo n.º 3
0
 def attempt_login(session: Session, username, password) -> str:
     url = URL.login_url()
     payload = Payload.login_payload(username, password)
     response = session.post(url, data=payload)
     if Crawler._succeed_login(response):
         return response.text
     elif "Oregon eCourt is temporarily unavailable due to maintenance" in response.text:
         raise OECIUnavailable
     else:
         raise InvalidOECIUsernamePassword
Ejemplo n.º 4
0
 def setUp(self):
     self.crawler = Crawler()
     with requests_mock.Mocker() as m:
         m.post(URL.login_url(), text=PostLoginPage.POST_LOGIN_PAGE)
         self.crawler.login('username', 'password')