package org.wso2.carbon.device.mgt.ios.payload.beans;

import org.testng.Assert;
import org.testng.annotations.Test;
import org.wso2.carbon.device.mgt.ios.payload.dto.PayloadOperationWrapper;
import org.wso2.carbon.device.mgt.ios.payload.exception.PListException;
import org.wso2.carbon.device.mgt.ios.payload.exception.ProfileConfigurationException;
import org.wso2.carbon.device.mgt.ios.payload.operation.CalendarOperations;

public class CalendarSubscriptionTestSuite {


    @Test(expectedExceptions = ProfileConfigurationException.class)
    public void testUsername() throws ProfileConfigurationException {

        CalendarSubscription calendarSubscription = new CalendarSubscription();
        calendarSubscription.setHostName("");
        calendarSubscription.validateRequest();

    }

    @Test
    public void testCalDAVPayload() throws ProfileConfigurationException, PListException {

        CalendarSubscription calendarSubscription = new CalendarSubscription();
        calendarSubscription.setAccountDescription("Account description");
        calendarSubscription.setHostName("hostname");
        calendarSubscription.setUsername("username");
        calendarSubscription.setPassword("password");
        calendarSubscription.setUseSSL(true);
        calendarSubscription.validateRequest();

        CalendarOperations calendarOperations = new CalendarOperations();
        PayloadOperationWrapper payload = calendarOperations.createCalenderSubscriptionPayload(calendarSubscription);

        Assert.assertNotNull(payload);

    }
}
