Пример #1
0
    def test_get_boards_with_invalid_authorization(self):
        # Initializing BoardService and retrieving board
        board_service = BoardService("test")
        headers = {}
        headers['Authorization'] = "somerandomstringhere"
        response = board_service.get_boards(headers)

        # Validating the response
        assert isinstance(response, str)
        self.assertEqual(response, "Invalid Authorization")
Пример #2
0
    def test_get_boards(self):
        # Initializing BoardService
        board_service = BoardService("test")
        # Creating a board
        board_service.create_board(self.board, self.headers)
        # Retrieving boards
        response = board_service.get_boards(self.headers)

        # Validating the response
        assert isinstance(response, list)
        self.assertGreaterEqual(len(response), 1)
Пример #3
0
def get_boards():
    try:
        # Fetching data from post body
        headers = request.headers
        # Invoking register method present in services
        board_service = BoardService()
        response = board_service.get_boards(headers)

        # Returning appropriate message
        if isinstance(response, list):
            return jsonpickle.encode(response, unpicklable=False), 200
        else:
            return jsonify({'errorMessage': response}), 500
    except Exception as e:
        return jsonify({'errorMessage': e}), 500