def test_etag_uses_app_version(): req = None app = App() controller = RESTController(app) tag1 = controller.etag('test') app.version = 2.0 tag2 = controller.etag('test') # Tag 1 and 2 must be different assert tag1 != tag2
def test_etag_generation(): req = None tagdata1 = [req, 1, 'testing', {'test': 'value'}] tagdata2 = [req, 1, 'TESTING', {'test': 'value'}] controller = RESTController(App()) tag1 = controller.etag(*tagdata1) tag2 = controller.etag(*tagdata2) # Tag 1 and 2 must be different assert tag1 != tag2 # Tags must be the same for the same data assert tag1 == controller.etag(*tagdata1)
def test_disallowed_post_to_resource(): # POST is only allowed on collections controller = RESTController(App()) with pytest.raises(MethodNotAllowed): controller.dispatch( EnvironBuilder(method='POST').get_request(), 'test')