# -*- coding: utf-8 -*-

# Copyright (C) 2021 Avencall
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>

from xivo_dao import meeting_room_dao
from xivo_dao.alchemy.meetingroom import MeetingRoom
from xivo_dao.tests.test_dao import DAOTestCase


class TestMeetingRoomFeaturesDAO(DAOTestCase):

    def _insert_meeting_room(self, meeting_room_id, name, display_name, number, pin=None):

        meeting_room = MeetingRoom()
        meeting_room.id = meeting_room_id
        meeting_room.name = name
        meeting_room.display_name = display_name
        meeting_room.number = number
        meeting_room.user_pin = pin

        self.add_me(meeting_room)

        return meeting_room

    def test_get_one_result(self):
        meeting_room = self._insert_meeting_room(1, 'conf1', 'Conf Room One', 2000)

        result = meeting_room_dao.get(meeting_room.id)

        self.assertEqual(result.id, meeting_room.id)
