photolib/tests/test_misc.py

38 lines
1.1 KiB
Python

import pytest
import cherrypy
from tests.lib import * # NOQA - fixtures
class PhotolibTestExample(PhotolibTest):
def test_index(self):
"""
Tests that the '/' url returns a redirect to '/feed'
"""
self.getPage("/")
self.assertStatus('302 Found')
self.assertHeaderEndsWith('Location', '/feed')
class PhotolibTestApi(PhotolibTest):
def test_photos(self):
self.getPage("/api/v1/photos")
self.assertStatus('200 OK')
def test_byhash(self):
self.getPage("/api/v1/byhash?sha=lol")
self.assertStatus('404 Not Found')
def test_user(self):
self.getPage("/api/v1/user")
self.assertStatus('200 OK')
# self.assertBody('Hello world')
# self.assertHeader('Content-Type', 'text/html;charset=utf-8')
# self.getPage("/echo?message=A+bient%F4t",
# headers=[
# ('Accept-Charset', 'ISO-8859-1,utf-8'),
# ('Content-Type', 'text/html;charset=ISO-8859-1')
# ]
# )