def create(self, processor_key, name=None, make_callback_url=None): """Create a company and return """ now = tables.now_func() company = tables.Company( guid='CP' + make_guid(), processor_key=processor_key, api_key=make_api_key(), callback_key=make_api_key(), name=name, created_at=now, updated_at=now, ) self.session.add(company) self.session.flush() if make_callback_url is not None: url = make_callback_url(company) processor = self.factory.create_processor() processor.configure_api_key(company.processor_key) processor.register_callback(company, url) return company
def create(self, processor_key, name=None): """Create a company and return """ now = tables.now_func() company = tables.Company( guid='CP' + make_guid(), processor_key=processor_key, api_key=make_api_key(), name=name, created_at=now, updated_at=now, ) self.session.add(company) self.session.flush() return company
def create(self, processor_key, name=None): """Create a company and return its id """ now = tables.now_func() company = tables.Company( guid='CP' + make_guid(), processor_key=processor_key, api_key=make_api_key(), name=name, created_at=now, updated_at=now, ) self.session.add(company) self.session.flush() return company.guid
def test_make_api_key(self): from billy.utils.generic import make_api_key # just make sure it is random api_keys = [make_api_key() for _ in range(1000)] self.assertEqual(len(set(api_keys)), 1000)
def test_make_api_key(self): # just make sure it is random api_keys = [make_api_key() for _ in range(1000)] self.assertEqual(len(set(api_keys)), 1000)