# Path: rocketchat_API/APIExceptions/RocketExceptions.py
# class RocketMissingParamException(Exception):
#     pass


import pytest
from rocketchat_API.APIExceptions.RocketExceptions import RocketMissingParamException
def test_rooms_get(logged_rocket):
    rooms_get = logged_rocket.rooms_get().json()
    assert rooms_get.get("success")


def test_rooms_clean_history(logged_rocket):
    rooms_clean_history = logged_rocket.rooms_clean_history(
        room_id="GENERAL",
        latest="2016-09-30T13:42:25.304Z",
        oldest="2016-05-30T13:42:25.304Z",
    ).json()
    assert rooms_clean_history.get("success")


def test_rooms_favorite(logged_rocket):
    rooms_favorite = logged_rocket.rooms_favorite(
        room_id="GENERAL", favorite=True
    ).json()
    assert rooms_favorite.get("success")

    rooms_favorite = logged_rocket.rooms_favorite(
        room_name="general", favorite=True
    ).json()
    assert rooms_favorite.get("success")

    rooms_favorite = logged_rocket.rooms_favorite(
        room_id="unexisting_channel", favorite=True
    ).json()
    assert not rooms_favorite.get("success")


# Path: rocketchat_API/APIExceptions/RocketExceptions.py
# class RocketMissingParamException(Exception):
#     pass


# Path: tests/test_rooms.py
import pytest
from rocketchat_API.APIExceptions.RocketExceptions import RocketMissingParamException

def test_rooms_get(logged_rocket):
    rooms_get = logged_rocket.rooms_get().json()
    assert rooms_get.get("success")


def test_rooms_clean_history(logged_rocket):
    rooms_clean_history = logged_rocket.rooms_clean_history(
        room_id="GENERAL",
        latest="2016-09-30T13:42:25.304Z",
        oldest="2016-05-30T13:42:25.304Z",
    ).json()
    assert rooms_clean_history.get("success")


def test_rooms_favorite(logged_rocket):
    rooms_favorite = logged_rocket.rooms_favorite(
        room_id="GENERAL", favorite=True
    ).json()
    assert rooms_favorite.get("success")

    rooms_favorite = logged_rocket.rooms_favorite(
        room_name="general", favorite=True
    ).json()
    assert rooms_favorite.get("success")

    rooms_favorite = logged_rocket.rooms_favorite(
        room_id="unexisting_channel", favorite=True
    ).json()
    assert not rooms_favorite.get("success")


    with pytest.raises(RocketMissingParamException):