Esempio n. 1
0
def get_publisher_profile(name):
    """
        DPR metadata put operation.
        This API is responsible for getting publisher profile
        ---
        tags:
            - profile
        parameters:
            - in: path
              name: publisher
              type: string
              required: true
              description: publisher name
        responses:
            404:
                description: Publisher not found
            500:
                description: Internal Server Error
            200:
                description: Success Message
                schema:
                    id: get_package_success
                    properties:
                        data:
                            type: object
                            description: data of publisher profile
                            properties:
                                description:
                                  type: string
                                title:
                                  type: string
                                name:
                                  type: string
                                joined:
                                  type: string
                                contact:
                                    type: object
                                    properties:
                                        phone:
                                            type: string
                                        email:
                                            type: string
                                        country:
                                            type: string

                        status:
                            type: string
                            default: SUCCESS
        """
    try:
        info = Publisher.get_publisher_info(name)
        if info is None:
            return handle_error("NOT_FOUND", "publisher not found", 404)
        return jsonify(dict(data=info, status="SUCCESS"))
    except Exception as e:
        app.logger.error(e)
        return handle_error('GENERIC_ERROR', e.message, 500)
Esempio n. 2
0
 def test_should_return_None_if_publisher_not_found(self):
     info = Publisher.get_publisher_info("not_found")
     self.assertIsNone(info)
Esempio n. 3
0
 def test_should_return_contact_info_if_public(self):
     info = Publisher.get_publisher_info(self.publisher_one)
     self.assertIn("contact", info)
     self.assertEqual(self.publisher_one, info['name'])