Package tests :: Module test_GitModifier

[hide private]
[frames] | no frames]

# Module test_GitModifier

Test gbp.git.GitModifier

Functions | [hide private]

test_author() Methods tested: |

test_date() Methods tested: |

test_dict() Test `dict` interface >>> import gbp.git >>> modifier = gbp.git.GitModifier('foo', 'bar', 1) >>> sorted(modifier.keys()) ['date', 'email', 'name'] >>> sorted(modifier.items()) [('date', '1 +0000'), ('email', 'bar'), ('name', 'foo')] |

Variables | [hide private]

| __package__ = ``'``tests``'``

Function Details | [hide private]

### test_author()

Methods tested:

- gbp.git.GitModifier.get_author_env
- gbp.git.GitModifier.get_committer_env
- gbp.git.GitModifier.keys

    >>> import gbp.git
    >>> modifier = gbp.git.GitModifier('foo', 'bar')
    >>> modifier.name
    'foo'
    >>> modifier.email
    'bar'
    >>> modifier.get_author_env()
    {'GIT_AUTHOR_EMAIL': 'bar', 'GIT_AUTHOR_NAME': 'foo'}
    >>> modifier.get_committer_env()
    {'GIT_COMMITTER_NAME': 'foo', 'GIT_COMMITTER_EMAIL': 'bar'}
    >>> modifier._get_env('foo')
    Traceback (most recent call last):
    ...
    GitModifierError: Neither comitter nor author
    >>> modifier['name']
    'foo'
    >>> modifier['email']
    'bar'
    >>> modifier['date']

### test_date()

Methods tested:

- gbp.git.GitModifier.__init__

Properties tested:

- gbp.git.GitModifier.date
- gbp.git.GitModifier.datetime
- gbp.git.GitModifier.tz_offset

    >>> import gbp.git
    >>> import datetime
    >>> modifier = gbp.git.GitModifier('foo', 'bar', 1)
    >>> modifier.date
    '1 +0000'
    >>> modifier.date = '1 +0400'
    >>> modifier.date
    '1 +0400'
    >>> modifier['date']
    '1 +0400'
    >>> modifier.datetime   # doctest: +ELLIPSIS
    datetime.datetime(1970, 1, 1, 4, 0, 1, tzinfo=<gbp.git.modifier.GitTz...>)
    >>> modifier.date = datetime.datetime(1970, 1, 1, 0, 0, 1)
    >>> modifier.date
    '1 +0000'
    >>> modifier.datetime   # doctest: +ELLIPSIS
    datetime.datetime(1970, 1, 1, 0, 0, 1, tzinfo=<gbp.git.modifier.GitTz...>)
    >>> modifier.tz_offset
    '+0000'