Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
smn committed Feb 17, 2015
1 parent 1f5d5ed commit 8c0774e
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions unicore/distribute/tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import json
import os
import textwrap

from StringIO import StringIO
from unittest import TestCase

from elasticgit.tests.base import TestPerson, ModelBaseTest
from elasticgit.commands.avro import serialize

from unicore.distribute.utils import (
UCConfigParser, get_repositories, get_repository, format_repo)
UCConfigParser, get_repositories, get_repository, format_repo,
format_content_type)

from elasticgit.tests.base import ModelBaseTest

from git import Repo

Expand Down Expand Up @@ -65,3 +70,17 @@ def test_format_repo(self):
self.assertEqual(
formatted['author'], '%s <%s>' % (last_commit.author.name,
last_commit.author.email))

def test_format_content_type(self):
p = TestPerson({'name': 'Foo', 'age': 1})
schema_string = serialize(TestPerson)
schema = json.loads(schema_string)
self.workspace.sm.store_data(
os.path.join(
'_schemas',
'%(namespace)s.%(name)s.avsc' % schema),
schema_string, 'Writing the schema.')
self.workspace.save(p, 'Saving a person.')
[model_obj] = format_content_type(
self.workspace.repo, '%(namespace)s.%(name)s' % schema)
self.assertEqual(TestPerson(model_obj), p)

0 comments on commit 8c0774e

Please sign in to comment.