Beispiel #1
0
 def test_show(self):
     c = Controller({}, self.mock_app)
     req = Request.blank('?id=test')
     id = c.create(req).body['id']
     c = Controller({'id': '00000000-0000-0000-0000-000000000000'},
                    self.mock_app)
     req = Request.blank('')
     self.assertRaises(HTTPNotFound, c.show, req)
     c = Controller({'id': id}, self.mock_app)
     req = Request.blank('')
     res = c.show(req)
     self.assertEqual(res.body['id'], id)
Beispiel #2
0
 def test_show(self):
     c = Controller({}, self.mock_app)
     req = Request.blank('?id=test')
     id = c.create(req).body['id']
     c = Controller({'id': '00000000-0000-0000-0000-000000000000'},
                    self.mock_app)
     req = Request.blank('')
     self.assertRaises(HTTPNotFound, c.show, req)
     c = Controller({'id': id}, self.mock_app)
     req = Request.blank('')
     res = c.show(req)
     self.assertEqual(res.body['id'], id)
Beispiel #3
0
 def test_delete(self):
     c = Controller({}, self.mock_app)
     req = Request.blank('?id=test')
     id = c.create(req).body['id']
     c = Controller({'id': '00000000-0000-0000-0000-000000000000'},
                    self.mock_app)
     req = Request.blank('')
     self.assertRaises(HTTPNotFound, c.delete, req)
     c = Controller({'id': id}, self.mock_app)
     req = Request.blank('')
     res = c.delete(req)
     self.assertEqual(res.body['id'], id)
     self.assertEqual(res.body['status'], 'DELETED')
Beispiel #4
0
 def test_delete(self):
     c = Controller({}, self.mock_app)
     req = Request.blank('?id=test')
     id = c.create(req).body['id']
     c = Controller({'id': '00000000-0000-0000-0000-000000000000'},
                    self.mock_app)
     req = Request.blank('')
     self.assertRaises(HTTPNotFound, c.delete, req)
     c = Controller({'id': id}, self.mock_app)
     req = Request.blank('')
     res = c.delete(req)
     self.assertEqual(res.body['id'], id)
     self.assertEqual(res.body['status'], 'DELETED')
Beispiel #5
0
 def test_index(self):
     c = Controller({}, self.mock_app)
     req = Request.blank('')
     res = c.index(req)
     self.assertEqual(res.body, [])
     req = Request.blank('?id=test')
     res = c.create(req)
     req = Request.blank('?id=test2')
     res = c.create(req)
     req = Request.blank('')
     res = c.index(req)
     self.assertEqual(len(res.body), 2)
     req = Request.blank('?id=test2')
     res = c.index(req)
     self.assertEqual(len(res.body), 1)
     self.assertEqual(res.body[0]['id'], 'test2')
Beispiel #6
0
 def test_index(self):
     c = Controller({}, self.mock_app)
     req = Request.blank('')
     res = c.index(req)
     self.assertEqual(res.body, [])
     req = Request.blank('?id=test')
     res = c.create(req)
     req = Request.blank('?id=test2')
     res = c.create(req)
     req = Request.blank('')
     res = c.index(req)
     self.assertEqual(len(res.body), 2)
     req = Request.blank('?id=test2')
     res = c.index(req)
     self.assertEqual(len(res.body), 1)
     self.assertEqual(res.body[0]['id'], 'test2')
Beispiel #7
0
 def test_create(self):
     c = Controller({}, self.mock_app)
     req = Request.blank('?id=test')
     res = c.create(req)
     self.assertEqual(res.body['id'], 'test')
Beispiel #8
0
 def test_create(self):
     c = Controller({}, self.mock_app)
     req = Request.blank('?id=test')
     res = c.create(req)
     self.assertEqual(res.body['id'], 'test')