Fix: GET party method
This commit is contained in:
parent
ad90f666d1
commit
00c7052838
@ -47,20 +47,11 @@ def party(request, pool, party: int):
|
||||
Party = pool.get('party.party')
|
||||
if request.method == 'GET':
|
||||
parties = Party.search_read(
|
||||
[],
|
||||
[('id', '=', party)],
|
||||
order=[('id', 'ASC')],
|
||||
fields_names=['id', 'name'])
|
||||
return parties
|
||||
|
||||
if request.method == 'POST':
|
||||
data = json.loads(
|
||||
request.get_data().decode()
|
||||
)
|
||||
|
||||
party = Party()
|
||||
party.name = data['name']
|
||||
party.save()
|
||||
|
||||
|
||||
@app.route('/<database_name>/sale_don_confiao/products', methods=['GET'])
|
||||
@allow_null_origin
|
||||
|
@ -54,8 +54,11 @@ class DonConfiaoApiRouteTestCase(
|
||||
'Authorization': f'bearer {self.key}',
|
||||
})
|
||||
|
||||
party, = json.loads(
|
||||
response.get_data().decode())
|
||||
|
||||
self.assertEqual(response.status_code, HTTPStatus.OK)
|
||||
self.assertIsNotNone(response.get_data())
|
||||
self.assertEqual(party['name'], 'Dunkan')
|
||||
|
||||
def test_post_parties(self):
|
||||
client = self.client()
|
||||
|
Loading…
Reference in New Issue
Block a user