forked from getsentry/sentry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Katie Lundsgaard
committed
Jan 27, 2017
1 parent
8851b3f
commit 918ac56
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from __future__ import absolute_import | ||
|
||
from uuid import uuid4 | ||
|
||
from sentry.api.serializers import serialize | ||
from sentry.models import (Commit, CommitAuthor, | ||
Release, ReleaseCommit, Repository) | ||
from sentry.testutils import TestCase | ||
|
||
|
||
class CommitSerializerTest(TestCase): | ||
def test_simple(self): | ||
user = self.create_user() | ||
project = self.create_project() | ||
release = Release.objects.create( | ||
organization_id=project.organization_id, | ||
version=uuid4().hex, | ||
) | ||
release.add_project(project) | ||
repository = Repository.objects.create( | ||
organization_id=project.organization_id, | ||
name='test/test', | ||
) | ||
commit_author = CommitAuthor.objects.create( | ||
name='stebe', | ||
email='[email protected]', | ||
organization_id=project.organization_id, | ||
) | ||
commit = Commit.objects.create( | ||
organization_id=project.organization_id, | ||
repository_id=repository.id, | ||
key='abc', | ||
author=commit_author, | ||
message='waddap', | ||
) | ||
ReleaseCommit.objects.create( | ||
organization_id=project.organization_id, | ||
project_id=project.id, | ||
release=release, | ||
commit=commit, | ||
order=1, | ||
) | ||
result = serialize(commit, user) | ||
|
||
assert result['message'] == 'waddap' | ||
assert result['repository']['name'] == 'test/test' | ||
assert result['author'] == {'name': 'stebe', 'email': '[email protected]'} |