~fabricematrat/charmworld/redirect-charm

« back to all changes in this revision

Viewing changes to charmworld/testing/factory.py

  • Committer: Benji York
  • Date: 2013-11-18 20:38:47 UTC
  • mto: This revision was merged to the branch mainline in revision 465.
  • Revision ID: benji@benjiyork.com-20131118203847-2mfs1w7b8aqy64mr
checkpoint

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
)
31
31
from charmworld.models import (
32
32
    Bundle,
 
33
    Charm,
33
34
    CharmFileSet,
34
35
    construct_charm_id,
35
36
    getfs,
317
318
    return record_id, charm
318
319
 
319
320
 
 
321
def make_charm(db, **kwargs):
 
322
    """Create a new charm and add it to the database.
 
323
 
 
324
    This function returns a charm model.
 
325
    """
 
326
    charm_data = get_charm_json(**kwargs)
 
327
    db.charms.insert(charm_data)
 
328
    return Charm(charm_data)
 
329
 
 
330
 
320
331
def get_bundle_data(name=None, owner=None, basket_with_rev=None,
321
332
                    series='precise', title='', description='',
322
333
                    services=dict(), relations=dict(), promulgated=False,