Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Port tests to Python 2.5

  • Loading branch information...
commit 4efd71299a90e465c94d072fa76f518aa2243010 1 parent 4e66ab7
@kyleconroy kyleconroy authored
View
1  requirements.txt
@@ -4,3 +4,4 @@ nose==1.1.2
sphinx
git+git://github.com/kyleconroy/webtest.git
git+git://github.com/kyleconroy/python-oauth2.git
+simplejson
View
6 tests/base.py
@@ -1,4 +1,8 @@
-import json
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
import os
import unittest
View
5 tests/runner.py
@@ -1,9 +1,5 @@
#!/usr/bin/python
-import argparse
-import logging
import sys
-import unittest
-import os
import nose
SDK_PATH = "/usr/local/google_appengine/"
@@ -16,6 +12,5 @@ def main():
dev_appserver.fix_sys_path()
nose.main()
-
if __name__ == '__main__':
main()
View
6 tests/test_api.py
@@ -1,5 +1,9 @@
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
import oauth2 as oauth
-import json
import urllib
import unittest
import requests
View
14 tests/test_rest_events.py
@@ -1,4 +1,8 @@
-import json
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
import models
from test_api import StashboardTest
@@ -86,7 +90,7 @@ def test_delete_wrong_event(self):
event = models.Event(service=service, status=self.status, message="foo")
event.put()
- url = "/admin/api/v1/services/foo/events/{}".format(event.key())
+ url = "/admin/api/v1/services/foo/events/%s" % event.key()
response = self.delete(url)
self.assertEquals(response.status_code, 404)
@@ -97,12 +101,12 @@ def test_get_wrong_event(self):
event = models.Event(service=service, status=self.status, message="foo")
event.put()
- url = "/admin/api/v1/services/foo/events/{}".format(event.key())
+ url = "/admin/api/v1/services/foo/events/%s" % event.key()
response = self.get(url)
self.assertEquals(response.status_code, 404)
def test_get_event(self):
- url = "/admin/api/v1/services/foo/events/{}".format(self.event.key())
+ url = "/admin/api/v1/services/foo/events/%s" % self.event.key()
response = self.get(url)
self.assertEquals(response.headers["Content-Type"], "application/json")
self.assertEquals(response.status_code, 200)
@@ -116,7 +120,7 @@ def test_post_wrong_version(self):
self.assertEquals(response.status_code, 405)
def test_delete_event(self):
- url = "/admin/api/v1/services/foo/events/{}".format(self.event.key())
+ url = "/admin/api/v1/services/foo/events/%s" % self.event.key()
response = self.delete(url)
self.assertEquals(response.headers["Content-Type"], "application/json")
self.assertEquals(response.status_code, 200)
View
6 tests/test_rest_images.py
@@ -1,4 +1,8 @@
-import json
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
from test_api import StashboardTest
class ImageTest(StashboardTest):
View
7 tests/test_rest_levels.py
@@ -1,4 +1,9 @@
-import json
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
+
from models import Service
from test_api import StashboardTest
View
6 tests/test_rest_status.py
@@ -1,4 +1,8 @@
-import json
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
from models import Status, Image
from test_api import StashboardTest
View
13 tests/test_rss.py
@@ -1,8 +1,11 @@
-import json
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
import datetime
import random
import xml.etree.ElementTree
-
import models
import settings
from test_api import StashboardTest
@@ -29,7 +32,7 @@ def setUp(self):
def test_empty_feed(self):
response = self.get("/rss")
- self.assertEquals(response.headers["Content-Type"], "application/rss+xml")
+ self.assertTrue("application/rss+xml" in response.headers["Content-Type"])
self.assertEquals(response.status_code, 200)
def test_feed_with_events(self):
@@ -38,7 +41,7 @@ def test_feed_with_events(self):
status=random.choice(self.statuses))
event.put()
response = self.get("/rss")
- self.assertEquals(response.headers["Content-Type"], "application/rss+xml")
+ self.assertTrue("application/rss+xml" in response.headers["Content-Type"])
self.assertEquals(response.status_code, 200)
result = xml.etree.ElementTree.fromstring(response.content)
@@ -69,7 +72,7 @@ def test_feed_does_not_exceed_max(self):
response = self.get("/rss")
- self.assertEquals(response.headers["Content-Type"], "application/rss+xml")
+ self.assertTrue("application/rss+xml" in response.headers["Content-Type"])
self.assertEquals(response.status_code, 200)
result = xml.etree.ElementTree.fromstring(response.content)
View
6 tests/test_service_lists.py
@@ -1,4 +1,8 @@
-import json
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
from mock import patch
from models import Service, List
from test_api import StashboardTest
View
6 tests/test_services.py
@@ -1,4 +1,8 @@
-import json
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
from mock import patch
from models import Service, List
from test_api import StashboardTest
Please sign in to comment.
Something went wrong with that request. Please try again.