aboutsummaryrefslogtreecommitdiffstats
path: root/pygithub3/tests/requests/test_core.py
diff options
context:
space:
mode:
Diffstat (limited to 'pygithub3/tests/requests/test_core.py')
-rw-r--r--pygithub3/tests/requests/test_core.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/pygithub3/tests/requests/test_core.py b/pygithub3/tests/requests/test_core.py
index a46c1d9..68663c0 100644
--- a/pygithub3/tests/requests/test_core.py
+++ b/pygithub3/tests/requests/test_core.py
@@ -70,12 +70,17 @@ class TestRequest(TestCase):
self.assertIsNone(request.get_body())
-class TestRequestBody(TestCase):
+class TestRequestBodyWithSchema(TestCase):
def setUp(self):
valid_body = dict(schema=('arg1', 'arg2'), required=('arg1', ))
self.b = Body({}, **valid_body)
+ def test_with_body_empty_and_schema_permissive(self):
+ self.b.schema = ('arg1', 'arg2', '...')
+ self.b.required = ()
+ self.assertEqual(self.b.dumps(), {})
+
def test_with_required(self):
self.b.content = dict(arg1='arg1')
self.assertEqual(self.b.dumps(), dict(arg1='arg1'))
@@ -88,9 +93,9 @@ class TestRequestBody(TestCase):
self.b.content = 'invalid'
self.assertRaises(ValidationError, self.b.dumps)
- def test_without_body(self):
+ def test_with_body_as_None(self):
self.b.content = None
- self.assertIsNone(self.b.dumps())
+ self.assertRaises(ValidationError, self.b.dumps)
def test_only_valid_keys(self):
self.b.content = dict(arg1='arg1', arg2='arg2', fake='test')