Ejemplo n.º 1
0
    def __init__(self, args, mongo=None):
        if not isinstance(args, dict):
            args = vars(args)
        self.args = args
        self.live = False

        logging.basicConfig(format='%(asctime)s - %(module)s - %(levelname)s -'
                                   ' %(message)s')
        self.logger = logging.getLogger("logger")
        self.logger.setLevel(self.args['log_level'])
        fh = logging.FileHandler(self.args['log'])
        self.logger.addHandler(fh)

        self.logger.info("Initializing SFDC++")
        self.logger.debug(self.args)

        if mongo is None:
            try:
                self.mongo = pymongo.MongoClient(self.args['mongo_uri'])
            except pymongo.errors.PyMongoError as e:
                self.logger.exception(e)
                raise e
        else:
            self.mongo = mongo

        # Initialize dbs and collections
        self.db_support = self.mongo.support

        try:
            self.sfdc = pyforce.PythonClient()
            self.sfdc.login(self.args['sfdc_username'],
                            self.args['sfdc_password'])
        except pyforce.SoapFaultError as e:
            self.logger.exception(e)
            raise e
Ejemplo n.º 2
0
    def __init__(self, args):
        """ Initializes Tests class with a database object.
        :return: None
        """
        if not isinstance(args, dict):
            args = vars(args)
        self.args = args

        self.connection = pyforce.PythonClient(self.args['sf_server'])
        # TODO try/except
        self.connection.login(self.args['sf_username'], self.args['sf_password'])
Ejemplo n.º 3
0
 def setUp(self):
     self.svc = svc = pyforce.PythonClient(serverUrl=SERVER_URL)
     svc.login(os.getenv('SF_USERNAME'), os.getenv('SF_PASSWORD'))
     self._todelete = list()
Ejemplo n.º 4
0
def init_sf(url, username, password, token):
    """Connect to Salesforce"""
    conn = pyforce.PythonClient(serverUrl=url)
    conn.login(username, "".join([password, token]))
    return conn
 def setUp(self):
     self.svc = svc = pyforce.PythonClient()
     svc.login(sfconfig.USERNAME, sfconfig.PASSWORD)
     self._todelete = list()
Ejemplo n.º 6
0
 def setUp(self):
     self.svc = svc = pyforce.PythonClient(
         serverUrl='https://www.salesforce.com/services/Soap/u/15.0')
     svc.login(sfconfig.USERNAME, sfconfig.PASSWORD)
     self._todelete = list()