예제 #1
0
class CalendarManagerTest(unittest.TestCase):
    """
    Base class for all calendar manager tests.

    A event calendar is herited from a vevent,
    that is why this class is herited from
    VeventManagerTest
    """

    def setUp(self):
        """
        initialize a manager.
        """

        self.manager = CalendarManager(storage=Middleware.get_middleware_by_uri('mongodb-default-calendar://'))
        self.document_content = self.manager.get_document(
            category="2", output="true date or not",
            dtstart=1434359519, dtend=1434705119
        )
        self.vevent_content = self.manager.get_vevent(
            self.document_content
        )
        print("type and value of vevent_content", self.vevent_content)

    def tearDown(self):
        pass

    def clean(self):
        # call of remove_by_source without param to clean DB
        self.manager.remove_by_source()

    def get_calendar(self):
        return self.manager.find(ids=self.ids)
예제 #2
0
    def setUp(self):
        """
        initialize a manager.
        """

        self.manager = CalendarManager(storage=Middleware.get_middleware_by_uri('mongodb-default-calendar://'))
        self.document_content = self.manager.get_document(
            category="2", output="true date or not",
            dtstart=1434359519, dtend=1434705119
        )
        self.vevent_content = self.manager.get_vevent(
            self.document_content
        )
        print("type and value of vevent_content", self.vevent_content)
예제 #3
0
    def setUp(self):
        """
        initialize a manager.
        """

        self.manager = CalendarManager()
        self.document_content = self.manager.get_document(
            category="2", output="true date or not", dtstart=1434359519, dtend=1434705119
        )
        self.vevent_content = self.manager.get_vevent(self.document_content)
        print("type and value of vevent_content", self.vevent_content)
예제 #4
0
# Canopsis 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Canopsis.  If not, see <http://www.gnu.org/licenses/>.
# ---------------------------------

from json import dumps

from canopsis.ccalendar.manager import CalendarManager
from canopsis.common.ws import route
from canopsis.common.middleware import Middleware

cm = CalendarManager(storage=Middleware.get_middleware_by_uri(
    CalendarManager.CALENDAR_COLL_URI))


def exports(ws):
    @route(ws.application.get, name='calendar')
    def get_by_uids(uids,
                    limit=0,
                    skip=0,
                    sort=None,
                    projection=None,
                    with_count=False):
        """Get documents by uids.

        :param list uids: list of document uids.
        :param int limit: max number of elements to get.
        :param int skip: first element index among searched list.