Exemple #1
0
 def test_update_client(self):
     repo = Repository()
     undo_service = UndoService()
     client_service = ClientService(repo, undo_service)
     client_service.add_client(1, "Popescu Alin")
     client_service.update_client(1, "Ionescu George")
     list_clients = client_service.list_clients()
     self.assertEqual(len(list_clients), 1)
     with self.assertRaises(IdError):        # client does not exist
         client_service.update_client(2, "Mara")
Exemple #2
0
 def put_client(client_id):
     try:
         client = Client.json_parse(request.json)
         client.client_id = int(client_id)
         client = ClientService.update_client(client)
         return jsonify(client.json()), 200
     except ResourceNotFound as r:
         return r.message, 404