def update_pet(body, id, name, category, photo_urls, tags, status): # noqa: E501 """Update an existing pet Update an existing pet by Id # noqa: E501 :param body: Update an existent pet in the store :type body: dict | bytes :param id: :type id: int :param name: :type name: str :param category: :type category: dict | bytes :param photo_urls: :type photo_urls: List[str] :param tags: :type tags: list | bytes :param status: :type status: str :rtype: Pet """ if connexion.request.is_json: body = Pet.from_dict(connexion.request.get_json()) # noqa: E501 if connexion.request.is_json: category = Category.from_dict( connexion.request.get_json()) # noqa: E501 if connexion.request.is_json: tags = [Tag.from_dict(d) for d in connexion.request.get_json()] # noqa: E501 return 'do some magic!'
def test_update_cat(self): """Test case for update_cat Promeni postojecu kategoriju """ body = Category() response = self.client.open('/v2/category', method='PUT', data=json.dumps(body), content_type='application/json') self.assert200(response, 'Response body is : ' + response.data.decode('utf-8'))
def test_add_cat(self): """Test case for add_cat Dodaj novu kategoriju """ body = Category() response = self.client.open('/v2/category', method='POST', data=json.dumps(body), content_type='application/json') self.assert200(response, 'Response body is : ' + response.data.decode('utf-8'))
def update_cat(body): # noqa: E501 """Promeni postojecu kategoriju # noqa: E501 :param body: Objekat za kategoriju koji treba da se doda u bazu :type body: dict | bytes :rtype: None """ if connexion.request.is_json: body = Category.from_dict(connexion.request.get_json()) # noqa: E501 return 'do some magic!'
def add_cat(body): # noqa: E501 """Dodaj novu kategoriju # noqa: E501 :param body: Objekat za kategoriju koji treba da se doda u bazu :type body: dict | bytes :rtype: None """ if connexion.request.is_json: body = Category.from_dict(connexion.request.get_json()) # noqa: E501 db_session.add(orm.Category(body.name)) db_session.commit() return NoContent, 201
def test_update_pet(self): """Test case for update_pet Update an existing pet """ body = Pet() data = dict(id=789, name='name_example', category=Category(), photo_urls='photo_urls_example', tags=Tag(), status='status_example') response = self.client.open( '/v3/pet', method='PUT', data=json.dumps(body), data=data, content_type='application/json') self.assert200(response, 'Response body is : ' + response.data.decode('utf-8'))