aboutsummaryrefslogtreecommitdiffstats
path: root/pygithub3/tests/resources/test_core.py
diff options
context:
space:
mode:
authorDavid Medina <davidmedina9@gmail.com>2012-02-12 12:44:06 +0100
committerDavid Medina <davidmedina9@gmail.com>2012-02-12 12:44:06 +0100
commit869e2abf99e56bb67adfda3b13330807743d7480 (patch)
treecd62b5942d8f04846b182a51bfcc17430d9cdebb /pygithub3/tests/resources/test_core.py
parentUpdate readme (diff)
downloadpython-github3-869e2abf99e56bb67adfda3b13330807743d7480.tar.xz
python-github3-869e2abf99e56bb67adfda3b13330807743d7480.zip
Support to map `self` in resources.
Very nested resources like Repo
Diffstat (limited to 'pygithub3/tests/resources/test_core.py')
-rw-r--r--pygithub3/tests/resources/test_core.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/pygithub3/tests/resources/test_core.py b/pygithub3/tests/resources/test_core.py
index 276c92f..1422667 100644
--- a/pygithub3/tests/resources/test_core.py
+++ b/pygithub3/tests/resources/test_core.py
@@ -4,7 +4,7 @@
from unittest import TestCase
from datetime import datetime
-from pygithub3.resources.base import Resource, Raw, json
+from pygithub3.resources.base import Raw
from pygithub3.tests.utils.resources import Nested, Simple, HasSimple
simple_resource = dict(type='simple')
@@ -16,7 +16,9 @@ github_return = dict(
simple=simple_resource,
list_collection=[has_simple] * 2,
items_collections=dict(arg1=has_simple, arg2=has_simple)
- )
+)
+github_return_nested = github_return.copy()
+github_return.update({'self_nested': github_return_nested})
class TestResourceMapping(TestCase):
@@ -45,6 +47,11 @@ class TestResourceMapping(TestCase):
self.assertEqual(arg1_has_simple.type, 'has_simple')
self.assertEqual(arg1_has_simple.simple.type, 'simple')
+ def test_SELF_nested(self):
+ self.assertIsInstance(self.r.self_nested, Nested)
+ self.assertIsInstance(self.r.self_nested.simple, Simple)
+ self.assertIsInstance(self.r.list_collection[0], HasSimple)
+ self.assertIsInstance(self.r.items_collections['arg1'], HasSimple)
class TestRawResource(TestCase):
""" Litle obvious :P """