예제 #1
0
    def test_create_empty_channelid_subscription(self):
        with self.settings(
                RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
            subscription = Subscription()
            subscription.endpoint = Endpoint()
            subscription.endpoint.endpoint_address = "*****@*****.**"
            subscription.endpoint.protocol = "Email"
            subscription.endpoint.owner = "javerage"
            subscription.endpoint.subscriber_id = "*****@*****.**"
            subscription.channel = Channel()

            nws = NWS()
            self.assertRaises(InvalidUUID, nws.create_new_subscription, subscription)
예제 #2
0
    def test_update_empty_subscriberid_subscription(self):
        with self.settings(
                RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
            subscription = Subscription()
            subscription.endpoint = Endpoint()
            subscription.endpoint.endpoint_address = "*****@*****.**"
            subscription.endpoint.protocol = "Email"
            subscription.endpoint.subscriber_id = ''
            subscription.endpoint.owner = "javerage"
            subscription.channel = Channel()
            subscription.channel.channel_id = "b779df7b-d6f6-4afb-8165-8dbe6232119f"

            nws = NWS()
            self.assertRaises(InvalidNetID, nws.update_subscription, subscription)
예제 #3
0
    def test_create_invalid_subscriberid_subscription(self):
        with self.settings(
                RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
            subscription = Subscription()
            subscription.subscription_id = "c4597f93-0f62-4feb-ac88-af5f0329001f"
            subscription.endpoint = Endpoint()
            subscription.endpoint.endpoint_address = "*****@*****.**"
            subscription.endpoint.protocol = "Email"
            subscription.endpoint.subscriber_id = "-@#$ksjdsfkli13290243290490"
            subscription.endpoint.owner = "javerage"
            subscription.channel = Channel()
            subscription.channel.channel_id = "b779df7b-d6f6-4afb-8165-8dbe6232119f"

            nws = NWS()
            self.assertRaises(InvalidNetID, nws.create_new_subscription, subscription)
예제 #4
0
    def test_create_empty_channelid_subscription(self):
        with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                           'restclients.dao_implementation.nws.File'):
            subscription = Subscription()
            subscription.endpoint = Endpoint()
            subscription.endpoint.endpoint_address = "*****@*****.**"
            subscription.endpoint.protocol = "Email"
            subscription.endpoint.subscriber_id = "javerage"
            subscription.endpoint.owner_id = "javerage"
            subscription.endpoint.user = "******"
            subscription.channel = Channel()

            nws = NWS()
            self.assertRaises(InvalidUUID, nws.create_new_subscription,
                              subscription)
예제 #5
0
    def test_update_empty_subscriberid_subscription(self):
        with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                           'restclients.dao_implementation.nws.File'):
            subscription = Subscription()
            subscription.endpoint = Endpoint()
            subscription.endpoint.endpoint_address = "*****@*****.**"
            subscription.endpoint.protocol = "Email"
            subscription.endpoint.user = ''
            subscription.endpoint.owner = "javerage"
            subscription.channel = Channel()
            subscription.channel.channel_id = "b779df7b-d6f6-4afb-8165-8dbe6232119f"

            nws = NWS()
            self.assertRaises(InvalidNetID, nws.update_subscription,
                              subscription)
예제 #6
0
    def test_update_subscription(self):
        with self.settings(
                RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
            subscription = Subscription()
            subscription.subscription_id = "c4597f93-0f62-4feb-ac88-af5f0329001f"
            subscription.endpoint = Endpoint()
            subscription.endpoint.endpoint_address = "*****@*****.**"
            subscription.endpoint.protocol = "Email"
            subscription.endpoint.subscriber_id = "*****@*****.**"
            subscription.endpoint.owner = "*****@*****.**"
            subscription.channel = Channel()
            subscription.channel.channel_id = "b779df7b-d6f6-4afb-8165-8dbe6232119f"

            nws = NWS()
            response_status = nws.update_subscription(subscription)
            self.assertEquals(response_status, 204)
예제 #7
0
    def test_update_subscription(self):
        with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                           'restclients.dao_implementation.nws.File'):
            subscription = Subscription()
            subscription.subscription_id = "c4597f93-0f62-4feb-ac88-af5f0329001f"
            subscription.endpoint = Endpoint()
            subscription.endpoint.endpoint_address = "*****@*****.**"
            subscription.endpoint.protocol = "Email"
            subscription.endpoint.user = "******"
            subscription.endpoint.owner = "*****@*****.**"
            subscription.channel = Channel()
            subscription.channel.channel_id = "b779df7b-d6f6-4afb-8165-8dbe6232119f"

            nws = NWS()
            response_status = nws.update_subscription(subscription)
            self.assertEquals(response_status, 204)
예제 #8
0
    def test_create_invalid_subscriberid_subscription(self):
        with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                           'restclients.dao_implementation.nws.File'):
            subscription = Subscription()
            subscription.subscription_id = "c4597f93-0f62-4feb-ac88-af5f0329001f"
            subscription.endpoint = Endpoint()
            subscription.endpoint.endpoint_address = "*****@*****.**"
            subscription.endpoint.protocol = "Email"
            subscription.endpoint.subscriber_id = "-@#$ksjdsfkli13290243290490"
            subscription.endpoint.owner_id = "javerage"
            subscription.channel = Channel()
            subscription.channel.channel_id = "b779df7b-d6f6-4afb-8165-8dbe6232119f"

            nws = NWS()
            self.assertRaises(InvalidNetID, nws.create_new_subscription,
                              subscription)
예제 #9
0
    def create(self, partial=True, to_consume=True):
        channel = Channel()
        channel.channel_id = 'b779df7b-d6f6-4afb-8165-8dbe6232119f'
        
        if not partial:
            channel.channel_uri = '/notification/v1/channel/b779df7b-d6f6-4afb-8165-8dbe6232119f'
            channel.surrogate_id = '2012,autumn,cse,100,w'
            channel.type = 'uw_student_courseavailable1'
            channel.name = 'FLUENCY IN INFORMATION TECHNOLOGY'
            channel.template_surrogate_id = 'CourseAvailableNotificationTemplate'
            channel.description = 'Introduces skills, concepts, and capabilities necessary to effectively use information technology. Includes logical reasoning, managing complexity, operation of computers and networks, and contemporary applications such as effective web searching and database manipulation, ethical aspects, and social impacts of information technology. Offered: jointly with INFO 100.\n'
        
        endpoint = Endpoint()
        endpoint.endpoint_id = 'ff53f5b8-f7f9-4eae-9d8b-b92717d4b670'
        
        if not partial:
            endpoint.endpoint_uri = '/notification/v1/endpoint/ff53f5b8-f7f9-4eae-9d8b-b92717d4b670'
            endpoint.endpoint_address = '+12223334444'
            endpoint.carrier = 'AT&T'
            endpoint.protocol = 'sms'
            endpoint.user = '******'
            endpoint.owner = '*****@*****.**'
            endpoint.status = 'unverified'
            endpoint.active = True
            endpoint.default = True
        
        subscription = Subscription()
        subscription.subscription_id = '6c9cd13c-10df-4f34-9023-d5e7316005c9'
        subscription.subscription_uri = '/notification/v1/subscription/6c9cd13c-10df-4f34-9023-d5e7316005c9'
#        subscription.subscription_type = 'Individual'
        subscription.channel = channel
        subscription.endpoint = endpoint
        
        if not to_consume:
            subscription.created = '2012-10-13 21:49:07.162630+00:00'
            subscription.last_modified = '2012-11-13 11:49:07.162630+00:00'
        
        return subscription
예제 #10
0
    def create(self, partial=True, to_consume=True):
        channel = Channel()
        channel.channel_id = 'b779df7b-d6f6-4afb-8165-8dbe6232119f'

        if not partial:
            channel.channel_uri = '/notification/v1/channel/b779df7b-d6f6-4afb-8165-8dbe6232119f'
            channel.surrogate_id = '2012,autumn,cse,100,w'
            channel.type = 'uw_student_courseavailable1'
            channel.name = 'FLUENCY IN INFORMATION TECHNOLOGY'
            channel.template_surrogate_id = 'CourseAvailableNotificationTemplate'
            channel.description = 'Introduces skills, concepts, and capabilities necessary to effectively use information technology. Includes logical reasoning, managing complexity, operation of computers and networks, and contemporary applications such as effective web searching and database manipulation, ethical aspects, and social impacts of information technology. Offered: jointly with INFO 100.\n'

        endpoint = Endpoint()
        endpoint.endpoint_id = 'ff53f5b8-f7f9-4eae-9d8b-b92717d4b670'

        if not partial:
            endpoint.endpoint_uri = '/notification/v1/endpoint/ff53f5b8-f7f9-4eae-9d8b-b92717d4b670'
            endpoint.endpoint_address = '+12223334444'
            endpoint.carrier = 'AT&T'
            endpoint.protocol = 'sms'
            endpoint.user = '******'
            endpoint.owner = '*****@*****.**'
            endpoint.status = 'unverified'
            endpoint.active = True
            endpoint.default = True

        subscription = Subscription()
        subscription.subscription_id = '6c9cd13c-10df-4f34-9023-d5e7316005c9'
        subscription.subscription_uri = '/notification/v1/subscription/6c9cd13c-10df-4f34-9023-d5e7316005c9'
        #        subscription.subscription_type = 'Individual'
        subscription.channel = channel
        subscription.endpoint = endpoint

        if not to_consume:
            subscription.created = '2012-10-13 21:49:07.162630+00:00'
            subscription.last_modified = '2012-11-13 11:49:07.162630+00:00'

        return subscription