def test_update_member(self): request = DummyRequest( method='PUT', path='/thing/1', post={'val': 'ONE'}, content_type='application/x-www-form-urlencoded') request.matchdict = {'id': 1} view = RESTfulView(_dummy_context_factory(), request) response = view.update_member() self.assertTrue(isinstance(response, Response)) self.assertEqual(response.status_int, 204)
def test_update_nonexistent_member(self): request = DummyRequest( method='PUT', path='/thing/42', post={'val': 'Forty-two'}, content_type='application/x-www-form-urlencoded') request.matchdict = {'id': 42} view = RESTfulView(_dummy_context_factory(), request) response = view.update_member() self.assertEqual(response.status_int, 201) self.assert_('Location' in response.headers) self.assertEqual(response.headers['Location'], '/thing/42')