コード例 #1
0
    def test_check_for_account_credentials_returns_true_if_provider_refresh_token_and_consumer_key_in_dict(self):
        result = helpers.check_for_account_credentials({
            "provider_refresh_token": "han",
            "provider_consumer_key": "shotfirst"
        })

        self.assertTrue(result)
コード例 #2
0
    def test_check_for_account_credentials_returns_true_if_provider_refresh_token_and_consumer_key_in_dict(
            self):
        result = helpers.check_for_account_credentials({
            "provider_refresh_token":
            "han",
            "provider_consumer_key":
            "shotfirst"
        })

        self.assertTrue(result)
コード例 #3
0
ファイル: lite.py プロジェクト: felipemarin/Python-ContextIO
    def post_user(self, **kwargs):
        req_args = ["email", "server", "username", "use_ssl", "port", "type"]

        if check_for_account_credentials(kwargs):
            all_args = [
                "password", "provider_refresh_token", "provider_consumer_key", "migrate_account_id",
                "first_name", "last_name"
            ] + req_args

            params = sanitize_params(kwargs, all_args, req_args)

            return User(self, self._request_uri("users", method="POST", params=params))
コード例 #4
0
    def post_user(self, **kwargs):
        req_args = ["email", "server", "username", "use_ssl", "port", "type"]

        if check_for_account_credentials(kwargs):
            all_args = [
                "password", "provider_refresh_token", "provider_consumer_key",
                "migrate_account_id", "first_name", "last_name"
            ] + req_args

            params = sanitize_params(kwargs, all_args, req_args)

            return User(
                self, self._request_uri("users", method="POST", params=params))
コード例 #5
0
ファイル: user.py プロジェクト: felipemarin/Python-ContextIO
    def post_email_account(self, **kwargs):
        req_args = ["email", "server", "username", "use_ssl", "port", "type"]

        all_args = req_args + ["status_callback_url", "password"]

        email_account = super(User, self).post(
            uri="email_accounts", params=kwargs, return_bool=False, all_args=all_args,
            required_args=req_args
        )

        if bool(email_account["success"]) is False:
            return False

        return EmailAccount(self, email_account)

        if check_for_account_credentials(kwargs):
            all_args = ["migrate_account_id", "first_name", "last_name"] + req_args
            params = sanitize_params(kwargs, all_args, req_args)

            return User(self, self._request_uri("users", method="POST", params=params))
コード例 #6
0
ファイル: user.py プロジェクト: sriharikapu/Python-ContextIO
    def post_email_account(self, **kwargs):
        req_args = ["email", "server", "username", "use_ssl", "port", "type"]

        all_args = req_args + ["status_callback_url"]

        email_account = super(User, self).post(uri="email_accounts",
                                               params=kwargs,
                                               return_bool=False,
                                               all_args=all_args,
                                               required_args=req_args)

        if bool(email_account["success"]) is False:
            return False

        return EmailAccount(self, email_account)

        if check_for_account_credentials(kwargs):
            all_args = ["migrate_account_id", "first_name", "last_name"
                        ] + req_args
            params = sanitize_params(kwargs, all_args, req_args)

            return User(
                self, self._request_uri("users", method="POST", params=params))
コード例 #7
0
 def test_check_for_account_credentials_raises_ArgumentError_if_refresh_token_missing(self):
     with self.assertRaises(ArgumentError):
         helpers.check_for_account_credentials({"provider_consumer_key": "shotfirst"})
コード例 #8
0
 def test_check_for_account_credentials_raises_ArgumentError_if_no_credentials(self):
     with self.assertRaises(ArgumentError):
         helpers.check_for_account_credentials({})
コード例 #9
0
    def test_check_for_account_credentials_returns_true_if_password_in_dict(self):
        result = helpers.check_for_account_credentials({"password": "******"})

        self.assertTrue(result)
コード例 #10
0
 def test_check_for_account_credentials_raises_ArgumentError_if_refresh_token_missing(
         self):
     with self.assertRaises(ArgumentError):
         helpers.check_for_account_credentials(
             {"provider_consumer_key": "shotfirst"})
コード例 #11
0
 def test_check_for_account_credentials_raises_ArgumentError_if_no_credentials(
         self):
     with self.assertRaises(ArgumentError):
         helpers.check_for_account_credentials({})
コード例 #12
0
    def test_check_for_account_credentials_returns_true_if_password_in_dict(
            self):
        result = helpers.check_for_account_credentials(
            {"password": "******"})

        self.assertTrue(result)