~jcsackett/charmworld/bac-tag-constraints

« back to all changes in this revision

Viewing changes to charmworld/testing/factory.py

  • Committer: Tarmac
  • Author(s): Aaron Bentley
  • Date: 2013-04-08 19:27:00 UTC
  • mfrom: (187.2.20 revisions-access)
  • Revision ID: tarmac-20130408192700-3w89hqewu4b1cdy9
[r=sinzui][bug=][author=abentley] Include revisions in API

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
    return date.fromordinal(start.toordinal() + int(increment))
66
66
 
67
67
 
68
 
def makeChange(committer=None, created=None, message=None, revno=None):
 
68
def makeChange(committer=None, created=None, message=None, revno=None,
 
69
               authors=None):
69
70
    """Generate a charm change.
70
71
 
71
72
    :param committer: The committer; a random user from `makeUser` if not
76
77
        provided.
77
78
    :param revno: The change's commit's revision number; a random number if
78
79
        not provided.
 
80
    :param authors: The change's authors, as a list of name/address strings
 
81
        as returned by bzrlib.revision.Revision.get_apparent_authors()
79
82
    """
80
83
    if not committer:
81
84
        committer = makeUser()
85
88
        message = random_string(50)
86
89
    if not revno:
87
90
        revno = randint(0, 100)
 
91
    if authors is None:
 
92
        authors = ['Foo <foo@example.com>', 'Bar <bar@example.com>']
88
93
 
89
 
    if type(created) is date:
 
94
    if isinstance(created, date):
90
95
        # Change `created` dates should be timestamps.
91
96
        created = mktime(created.timetuple())
92
97
    return {
 
98
        'authors': authors,
93
99
        'committer': committer,
94
100
        'created': created,
95
101
        'message': message,