示例#1
0
    def test_get_score(self):
        score, message = oauth.get_emailage_score(email=self.query_email, ip=self.query_ip,
                                                  customer_key=self.account_sid,
                                                  secret_token=self.auth_token, use_prod=USE_PROD,
                                                  score_only=True)
        assert score, "No score returned {}.".format(message)

        score, message = oauth.get_emailage_score(email=self.query_email, ip=self.query_ip,
                                                  customer_key=self.account_sid,
                                                  secret_token=self.auth_token, use_prod=USE_PROD,
                                                  score_only=False)
        assert score, "No score returned. {}.".format(message)
示例#2
0
    def test_no_creds_message(self):
        with self.assertRaises(EmailAgeServiceException) as ctx_mgr:
            _, _ = oauth.get_emailage_score(email=self.query_email, ip=self.query_ip,
                                            customer_key='',
                                            secret_token='', use_prod=False,
                                            score_only=True)

        assert 'Missing Credentials' in str(ctx_mgr.exception)

        with self.assertRaises(EmailAgeServiceException) as ctx_mgr:
            _, _ = oauth.get_emailage_score(email=self.query_email, ip=self.query_ip,
                                            customer_key='invalid',
                                            secret_token='credentials', use_prod=False,
                                            score_only=True)

            assert 'Authentication Error' in str(ctx_mgr.exception)
示例#3
0
    def test_no_creds_message(self):
        with self.assertRaises(EmailAgeServiceException) as ctx_mgr:
            _, _ = oauth.get_emailage_score(email=self.query_email,
                                            ip=self.query_ip,
                                            customer_key='',
                                            secret_token='',
                                            use_prod=False,
                                            score_only=True)

        assert 'Missing Credentials' in str(ctx_mgr.exception)

        with self.assertRaises(EmailAgeServiceException) as ctx_mgr:
            _, _ = oauth.get_emailage_score(email=self.query_email,
                                            ip=self.query_ip,
                                            customer_key='invalid',
                                            secret_token='credentials',
                                            use_prod=False,
                                            score_only=True)

            assert 'Authentication Error' in str(ctx_mgr.exception)