aboutsummaryrefslogtreecommitdiffstats
path: root/github3/tests/converters_test.py
diff options
context:
space:
mode:
authorDavid Medina <davidmedina9@gmail.com>2012-02-03 02:59:53 +0100
committerDavid Medina <davidmedina9@gmail.com>2012-02-03 02:59:53 +0100
commitae1c3c06c47866c8f392d05c63f597d71cebd691 (patch)
tree6543c55e2210bd91f59124785200d1fbfb6be872 /github3/tests/converters_test.py
parentUpdate setup.py (diff)
downloadpython-github3-ae1c3c06c47866c8f392d05c63f597d71cebd691.tar.xz
python-github3-ae1c3c06c47866c8f392d05c63f597d71cebd691.zip
Reset project
Diffstat (limited to 'github3/tests/converters_test.py')
-rw-r--r--github3/tests/converters_test.py96
1 files changed, 0 insertions, 96 deletions
diff --git a/github3/tests/converters_test.py b/github3/tests/converters_test.py
deleted file mode 100644
index 66eedc3..0000000
--- a/github3/tests/converters_test.py
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/env python
-# -*- encoding: utf-8 -*-
-
-from github3.converters import *
-from github3.models.base import BaseResource
-from unittest import TestCase
-from datetime import datetime
-
-API_STUB = {
- 'test_str': 'string',
- 'test_int': 1,
- 'test_date': '2008-01-14T04:33:35Z',
- 'test_bool': True,
- 'map': {'test_str': 'string'},
- 'dict_map': {
- 'map1': {
- 'test_str': 'string',
- 'test_int': 1
- },
- 'map2': {
- 'test_str': 'string',
- 'test_int': 2
- },
- },
- 'list_map': [
- {'test_str': 'string', 'test_int': 1},
- {'test_str': 'string', 'test_int': 2},
- ],
- 'fake_map': 9,
-}
-
-
-class Model(BaseResource):
-
- @classmethod
- def idl(self):
- return {
- 'strs': ['test_str'],
- 'ints': ['test_int'],
- 'dates': ['test_date'],
- 'bools': ['test_bool'],
- 'maps': {'map': Model, 'fake_map': Model},
- 'collection_maps': {
- 'dict_map': Model,
- 'list_map': Model,
- 'fake_map': Model,
- },
- }
-
-
-class TestModelizer(TestCase):
-
- def setUp(self):
- model = Model
- self.modelizer = Modelizer()
- self.modelizer.inject(model)
-
- def test_loads(self):
- parsed_model = self.modelizer.loads(API_STUB)
- self.assertEquals(len(parsed_model), len(API_STUB))
- self.assertEquals(parsed_model.test_str, 'string')
- self.assertEquals(parsed_model.test_int, 1)
- self.assertEquals(
- parsed_model.test_date,
- datetime(2008, 1, 14, 4, 33, 35))
- self.assertTrue(parsed_model.test_bool)
- self.assertTrue(isinstance(parsed_model.map, Model))
- self.assertEquals(parsed_model.map.test_str, 'string')
- self.assertTrue(isinstance(parsed_model.dict_map, dict))
- map1 = parsed_model.dict_map['map1']
- map2 = parsed_model.dict_map['map2']
- self.assertTrue(isinstance(map1, Model))
- self.assertTrue(isinstance(map2, Model))
- self.assertEquals(map1.test_str, 'string')
- self.assertEquals(map1.test_int, 1)
- self.assertEquals(map2.test_str, 'string')
- self.assertEquals(map2.test_int, 2)
-
- list_map = parsed_model.list_map
- self.assertTrue(isinstance(list_map, list))
- self.assertEquals(list_map[0].test_str, 'string')
- self.assertEquals(list_map[0].test_int, 1)
- self.assertEquals(list_map[1].test_str, 'string')
- self.assertEquals(list_map[1].test_int, 2)
-
-
-class TestRawlizer(TestCase):
-
- def setUp(self):
- model = Model
- self.rawlizer = Rawlizer()
-
- # Trivial, I know it
- def test_loads(self):
- raw = self.rawlizer.loads(API_STUB)
- self.assertEquals(raw, API_STUB)