def agreement_factory(**kwargs): """ Create an agreement with some defaults. """ if 'issuer' not in kwargs: kwargs['issuer'] = models.Issuer(name='') kwargs['issuer'].save() args = { 'file_name': '', 'size': 0, 'uri': 'https://example.com', 'description': '', } for key in kwargs: args[key] = kwargs[key] agreement = models.Agreement(**args) agreement.save() return agreement
def agreement_factory(**kwargs): """ Create an agreement with some defaults. """ if "issuer" not in kwargs: kwargs["issuer"] = models.Issuer(name="") kwargs["issuer"].save() args = { "file_name": "", "size": 0, "uri": "https://example.com", "description": "", } for key in kwargs: args[key] = kwargs[key] agreement = models.Agreement(**args) agreement.save() return agreement