示例#1
0
    def test_verify_many(self):
        result = appier.verify_many((1 == 1, 2 == 2, 3 == 3))
        self.assertEqual(result, None)

        result = appier.verify_many(("hello" == "hello", ))
        self.assertEqual(result, None)

        self.assertRaises(appier.AssertionError, lambda: appier.verify_many(
            (1 == 2, )))

        self.assertRaises(appier.AssertionError, lambda: appier.verify_many(
            (1 == 1, 1 == 2)))

        self.assertRaises(
            appier.OperationalError, lambda: appier.verify_many(
                (1 == 1, 1 == 2), exception=appier.OperationalError))
示例#2
0
 def oauth_authorize(self, state = None):
     url = self.login_url + "oauth2/auth"
     appier.verify_many((
         self.client_id,
         self.redirect_url,
         self.scope
     ))
     values = dict(
         client_id = self.client_id,
         redirect_uri = self.redirect_url,
         response_type = "code",
         scope = " ".join(self.scope)
     )
     if state: values["state"] = state
     data = appier.legacy.urlencode(values)
     url = url + "?" + data
     return url
示例#3
0
    def test_verify_many(self):
        result = appier.verify_many((1 == 1, 2 == 2, 3 == 3))
        self.assertEqual(result, None)

        result = appier.verify_many(("hello" == "hello",))
        self.assertEqual(result, None)

        self.assertRaises(appier.AssertionError, lambda: appier.verify_many((1 == 2,)))

        self.assertRaises(appier.AssertionError, lambda: appier.verify_many((1 == 1, 1 == 2)))

        self.assertRaises(
            appier.OperationalError,
            lambda: appier.verify_many(
                (1 == 1, 1 == 2),
                exception = appier.OperationalError
            )
        )