From 869e2abf99e56bb67adfda3b13330807743d7480 Mon Sep 17 00:00:00 2001 From: David Medina Date: Sun, 12 Feb 2012 12:44:06 +0100 Subject: Support to map `self` in resources. Very nested resources like Repo --- pygithub3/tests/resources/test_core.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'pygithub3/tests/resources') 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 """ -- cgit v1.2.3-59-g8ed1b