Ejemplo n.º 1
0
    def test_03_fail(self):
        responses.add(responses.POST,
                      "https://localhost/validate/check",
                      body=json.dumps(FAIL_BODY),
                      content_type="application/json")

        r = check_password({}, "cornelius", "test100002")
        self.assertEqual(r, UNAUTHORIZED)
Ejemplo n.º 2
0
    def test_01_success(self):
        responses.add(responses.POST,
                      "https://localhost/validate/check",
                      body=json.dumps(SUCCESS_BODY),
                      content_type="application/json")

        r = check_password({}, "cornelius", "test100001")
        self.assertEqual(r, OK)
Ejemplo n.º 3
0
    def test_03_fail(self):
        responses.add(responses.POST,
                      "https://localhost/validate/check",
                      body=json.dumps(FAIL_BODY),
                      content_type="application/json")

        r = check_password({}, "cornelius", "test100002")
        self.assertEqual(r, UNAUTHORIZED)
Ejemplo n.º 4
0
    def test_01_success(self):
        responses.add(responses.POST,
                      "https://localhost/validate/check",
                      body=json.dumps(SUCCESS_BODY),
                      content_type="application/json")

        r = check_password({}, "cornelius", "test100001")
        self.assertEqual(r, OK)
Ejemplo n.º 5
0
 def test_02_success_cache(self):
     # In this case, the password is successfully checked against the
     # redis database
     redismock.set_data({"+++cornelius": self.pw_dig})
     # The password is contained in the database and thus the privacyIDEA
     # server does not have to be asked. Therefor we can omit the response
     #  mock
     r = check_password({}, "cornelius", "test100001")
     self.assertEqual(r, OK)
Ejemplo n.º 6
0
 def test_02_success_cache(self):
     # In this case, the password is successfully checked against the
     # redis database
     redismock.set_data({"+++cornelius": self.pw_dig})
     # The password is contained in the database and thus the privacyIDEA
     # server does not have to be asked. Therefor we can omit the response
     #  mock
     r = check_password({}, "cornelius", "test100001")
     self.assertEqual(r, OK)