From 0cfd53700dd0379e9c7c18686e5df33d286be95e Mon Sep 17 00:00:00 2001 From: David Medina Date: Fri, 10 Feb 2012 21:54:38 +0100 Subject: Wip on services.users --- pygithub3/tests/requests/test_core.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'pygithub3/tests/requests') diff --git a/pygithub3/tests/requests/test_core.py b/pygithub3/tests/requests/test_core.py index f29ab1d..98c5f3f 100644 --- a/pygithub3/tests/requests/test_core.py +++ b/pygithub3/tests/requests/test_core.py @@ -34,6 +34,7 @@ class TestFactory(TestCase): request = self.f('users.get') self.assertIsInstance(request, Request) + class TestRequestUri(TestCase): def test_SIMPLE_with_correct_args(self): @@ -80,12 +81,17 @@ class TestRequestBody(TestCase): class TestBodyParsers(TestCase): - def setUp(self): - self.b = Body( + def test_only_valid_keys(self): + body = Body( dict(arg1='arg1', arg2='arg2', arg3='arg3', arg4='arg4'), ('arg1', 'arg3', 'arg4')) - - def test_RETURN_only_valid_keys(self): - get_body_returns = self.b.parse() - self.assertEqual(get_body_returns, dict(arg1='arg1', arg3='arg3', + self.assertEqual(body.parse(), dict(arg1='arg1', arg3='arg3', arg4='arg4')) + + def test_none(self): + body = Body({}, ('arg1', 'arg2')) + self.assertEqual(body.parse(), {}) + + def test_invalid_content(self): + body = Body('invalid', ('arg1',)) + self.assertRaises(ValidationError, body.parse) -- cgit v1.2.3-59-g8ed1b