Skip to content

Commit

Permalink
new special characters testing
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Nov 14, 2014
1 parent 8329e4e commit 6ecc214
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions data/src/entity_manager/test.py
Expand Up @@ -240,7 +240,7 @@ def test_metadata(self):
person = test_mocks.Person()
person.object_id = 1
person.name = "name_person"
person.metadata = dict(ocupation = "student", salary = 100)
person.metadata = dict(occupation = "student", salary = 100)
self.entity_manager.save(person)

# retrieves the person from the data source and verifies that
Expand All @@ -250,7 +250,25 @@ def test_metadata(self):
self.assertNotEqual(saved_person, None)
self.assertEqual(saved_person.object_id, 1)
self.assertEqual(saved_person.name, "name_person")
self.assertEqual(saved_person.metadata, dict(ocupation = "student", salary = 100))
self.assertEqual(saved_person.metadata, dict(occupation = "student", salary = 100))

# creates a new person and populates the information, this time
# the person's occupation is encoded with special characters in order
# to test the unicode encoding of metadata
person = test_mocks.Person()
person.object_id = 2
person.name = "name_person"
person.metadata = dict(occupation = colony.legacy.u("学生"), salary = 10)
self.entity_manager.save(person)

# retrieves the person from the data source and verifies that
# the complete information is correctly retrieved from the
# data source, including the metadata structure
saved_person = self.entity_manager.get(test_mocks.Person, 2)
self.assertNotEqual(saved_person, None)
self.assertEqual(saved_person.object_id, 2)
self.assertEqual(saved_person.name, "name_person")
self.assertEqual(saved_person.metadata, dict(occupation = colony.legacy.u("学生"), salary = 10))

def test_one_to_one(self):
# creates the required entity classes in the data source
Expand Down

0 comments on commit 6ecc214

Please sign in to comment.