aboutsummaryrefslogtreecommitdiffstats
path: root/github3/tests/handler_test.py
diff options
context:
space:
mode:
authorDavid Medina <davidmedina9@gmail.com>2011-11-28 01:07:42 +0100
committerDavid Medina <davidmedina9@gmail.com>2011-11-28 01:07:42 +0100
commit8060db65c51d551107eff76bf4e94ef82d9f869b (patch)
tree167577d9ccaa8ff175ee5c7595f2c71bd22ad52f /github3/tests/handler_test.py
parentDiff between 'my' and 'get' (diff)
downloadpython-github3-8060db65c51d551107eff76bf4e94ef82d9f869b.tar.xz
python-github3-8060db65c51d551107eff76bf4e94ef82d9f869b.zip
MimeType mixin
Diffstat (limited to 'github3/tests/handler_test.py')
-rw-r--r--github3/tests/handler_test.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/github3/tests/handler_test.py b/github3/tests/handler_test.py
index e691182..e95374b 100644
--- a/github3/tests/handler_test.py
+++ b/github3/tests/handler_test.py
@@ -4,7 +4,7 @@
from mock import Mock, patch
from unittest import TestCase
from github3 import api
-from github3.handlers.base import Handler
+from github3.handlers.base import Handler, MimeTypeMixin
from github3.exceptions import *
from github3.converters import *
from github3.models.user import User
@@ -13,6 +13,28 @@ import json
import requests
+class TestMimeTypeMixin(TestCase):
+
+ def setUp(self):
+ self.mixin = MimeTypeMixin()
+
+ def _parse_mime_type(self, type):
+ return 'application/vnd.github.%s.%s+json' % (
+ MimeTypeMixin.VERSION, type)
+
+ def test_add_mimetypes(self):
+ self.mixin.add_raw()
+ self.mixin.add_text()
+ self.mixin.add_html()
+ self.mixin.add_full()
+ self.assertEquals(sorted(self.mixin.mime_header()), sorted({
+ 'Accept': '%s, %s, %s, %s' % (
+ self._parse_mime_type('raw'),
+ self._parse_mime_type('text'),
+ self._parse_mime_type('html'),
+ self._parse_mime_type('full'))}))
+
+
class TestHandler(TestCase):
def setUp(self):