def __init__(self, product, provided_products=None, start_date=None, end_date=None, content=None, quantity=1, stacking_id=None, sockets=2, service_level=None, ram=None, pool=None, ent_id=None, entitlement_type=None): # If we're given strings, create stub products for them: if isinstance(product, str): product = StubProduct(product) if provided_products: temp = [] for p in provided_products: temp.append(StubProduct(p)) provided_products = temp products = [] if product: products.append(product) if provided_products: products = products + provided_products if not start_date: start_date = datetime.utcnow() if not end_date: end_date = start_date + timedelta(days=365) # to simulate a cert with no product sku = None name = None if product: sku = product.id name = product.name order = Order(name=name, number="592837", sku=sku, stacking_id=stacking_id, socket_limit=sockets, service_level=service_level, quantity_used=quantity, ram_limit=ram) order.warning_period = 42 if content is None: content = [] path = "/tmp/fake_ent_cert.pem" self.is_deleted = False version = Version("3.0") # might as well make this a big num since live serials #'s are already > maxint self.serial = random.randint(1000000000000000000, 10000000000000000000000) # write these to tmp, could we abuse PATH thing in certs for tests? path = "/tmp/fake_ent_cert-%s.pem" % self.serial super(StubEntitlementCertificate, self).__init__(path=path, products=products, order=order, content=content, pool=pool, start=start_date, end=end_date, serial=self.serial, version=version) if ent_id: self.subject = {'CN': ent_id} self._entitlement_type = entitlement_type or 'Basic'
def __init__(self, product, provided_products=None, start_date=None, end_date=None, content=None, quantity=1, stacking_id=None, sockets=2, service_level=None, ram=None, pool=None, ent_id=None, entitlement_type=None): # If we're given strings, create stub products for them: if isinstance(product, str): product = StubProduct(product) if provided_products: temp = [] for p in provided_products: temp.append(StubProduct(p)) provided_products = temp products = [] if product: products.append(product) if provided_products: products = products + provided_products if not start_date: start_date = datetime.utcnow() if not end_date: end_date = start_date + timedelta(days=365) # to simulate a cert with no product sku = None name = None if product: sku = product.id name = product.name order = Order(name=name, number="592837", sku=sku, stacking_id=stacking_id, socket_limit=sockets, service_level=service_level, quantity_used=quantity, ram_limit=ram) order.warning_period = 42 if content is None: content = [] path = "/tmp/fake_ent_cert.pem" self.is_deleted = False # might as well make this a big num since live serials #'s are already > maxint self.serial = random.randint(1000000000000000000, 10000000000000000000000) # write these to tmp, could we abuse PATH thing in certs for tests? path = "/tmp/fake_ent_cert-%s.pem" % self.serial super(StubEntitlementCertificate, self).__init__(path=path, products=products, order=order, content=content, pool=pool, start=start_date, end=end_date, serial=self.serial) if ent_id: self.subject = {'CN': ent_id} self._entitlement_type = entitlement_type or 'Basic'
def __init__(self, product, provided_products=None, start_date=None, end_date=None, content=None, quantity=1, stacking_id=None, sockets=2, service_level=None): products = [] if product: products.append(product) if provided_products: products = products + provided_products if not start_date: start_date = datetime.now() if not end_date: end_date = start_date + timedelta(days=365) # to simulate a cert with no product sku = None name = None if product: sku = product.id name = product.name order = Order(name=name, number="592837", sku=sku, stacking_id=stacking_id, socket_limit=sockets, service_level=service_level, quantity_used=quantity) if content is None: content = [] path = "/tmp/fake_ent_cert.pem" self.is_deleted = False EntitlementCertificate.__init__(self, path=path, products=products, order=order, content=content, start=start_date, end=end_date, serial=random.randint(1, 10000000))