Exemplo n.º 1
0
 def test_channel_surrogate_id(self):
     with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                        'restclients.dao_implementation.nws.File'):
         nws = NWS()
         channel = nws.get_channel_by_surrogate_id(
             "uw_student_courseavailable", "2012,autumn,cse,100,w")
         self._assert_channel(channel)
Exemplo n.º 2
0
 def test_endpoint_endpoint_id(self):
     with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                        'restclients.dao_implementation.nws.File'):
         nws = NWS()
         endpoint = nws.get_endpoint_by_endpoint_id(
             "780f2a49-2118-4969-9bef-bbd38c26970a")
         self._assert_endpoint_matches(endpoint)
Exemplo n.º 3
0
    def test_create_message_with_model_closed(self):
        with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                           'restclients.dao_implementation.nws.File'):

            course_available_event = CourseAvailableEvent()
            course_available_event.event_id = "blah"
            course_available_event.last_modified = "2012-12-23T09:00:00"
            course_available_event.space_available = 0
            course_available_event.quarter = "winter"
            course_available_event.year = 2012
            course_available_event.curriculum_abbr = "cse"
            course_available_event.course_number = "100"
            course_available_event.section_id = "aa"
            course_available_event.sln = "12345"
            course_available_event.notification_msg_0 = " NO"

            message = Message()
            message.message_type = "uw_student_courseavailable"
            message.content = course_available_event.json_data()
            self.assertEquals(message.content['Event']['Section']['SectionID'],
                              'AA')
            self.assertEquals(
                message.content['Event']['Section']['Course']
                ['CurriculumAbbreviation'], 'CSE')
            self.assertEquals(message.content['Event']['NotificationMsg0'],
                              ' NO')

            nws = NWS()
            response_status = nws.create_new_message(message)
            self.assertEquals(response_status, 200)
Exemplo n.º 4
0
 def test_person_by_uwregid(self):
     with self.settings(
             RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
         nws = NWS()
         person = nws.get_person_by_uwregid("9136CCB8F66711D5BE060004AC494FFE")
         self._assert_person_matches(person)
         self.assertEquals(4, len(person.endpoints))
Exemplo n.º 5
0
 def test_person_by_surrogate_id(self):
     with self.settings(
             RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
         nws = NWS()
         person = nws.get_person_by_surrogate_id("*****@*****.**")
         self._assert_person_matches(person)
         self.assertEquals(2, len(person.endpoints))
Exemplo n.º 6
0
 def test_subscriptions_subscriber_id(self):
     with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                        'restclients.dao_implementation.nws.File'):
         nws = NWS()
         subscriptions = nws.get_subscriptions_by_subscriber_id(
             "javerage", "10")
         self.assertEquals(len(subscriptions), 5)
Exemplo n.º 7
0
 def test_delete_subscription(self):
     with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                        'restclients.dao_implementation.nws.File'):
         nws = NWS()
         response_status = nws.delete_subscription(
             "652236c6-a85a-4845-8dc5-3e518bec044c")
         self.assertEquals(response_status, 204)
Exemplo n.º 8
0
 def _delete_channel_live(self):
     with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                        'restclients.dao_implementation.nws.Live'):
         nws = NWS()
         response_status = nws.delete_channel(
             "ce1d46fe-1cdf-4c5a-a316-20f6c99789b7")
         self.assertEquals(response_status, 204)
Exemplo n.º 9
0
 def test_channel_sln_and_term(self):
     with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                        'restclients.dao_implementation.nws.File'):
         nws = NWS()
         channels = nws.get_channels_by_sln_year_quarter(
             "uw_student_courseavailable", "12345", 2012, "autumn")
         self.assertEquals(len(channels), 1)
Exemplo n.º 10
0
    def test_create_message_with_json(self):
        with self.settings(
                RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):

            json = {
                "Event": {
                    "EventID":"blah",
                    "Href":"",
                    "LastModified":"2012-12-23T09:00:00",
                    "Section": {
                        "Course": {
                            "CourseNumber":"100",
                            "CurriculumAbbreviation":"cse",
                            "Quarter":"winter",
                            "Year":2012
                        },
                        "Href":"",
                        "SLN":"12345",
                        "SectionID":"aa"
                    },
                    "SpaceAvailable":1
                }
            }

            message = Message()
            message.message_type =  "uw_student_courseavailable"
            message.content = json

            nws = NWS()
            response_status = nws.create_new_message(message)
            self.assertEquals(response_status, 200)
Exemplo n.º 11
0
 def test_channel_channel_id(self):
     with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                        'restclients.dao_implementation.nws.File'):
         nws = NWS()
         channel = nws.get_channel_by_channel_id(
             "b779df7b-d6f6-4afb-8165-8dbe6232119f")
         self._assert_channel(channel)
Exemplo n.º 12
0
 def test_endpoint_by_subscriber_id_protocol(self):
     with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                        'restclients.dao_implementation.nws.File'):
         nws = NWS()
         endpoint = nws.get_endpoint_by_subscriber_id_and_protocol(
             "javerage", "sms")
         self._assert_endpoint_matches(endpoint)
Exemplo n.º 13
0
    def test_create_message_with_model_closed(self):
        with self.settings(
                RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):

            course_available_event = CourseAvailableEvent()
            course_available_event.event_id = "blah"
            course_available_event.last_modified = "2012-12-23T09:00:00"
            course_available_event.space_available = 0
            course_available_event.quarter = "winter"
            course_available_event.year = 2012
            course_available_event.curriculum_abbr = "cse"
            course_available_event.course_number = "100"
            course_available_event.section_id = "aa"
            course_available_event.sln = "12345"
            course_available_event.notification_msg_0 = " NO"

            message = Message()
            message.message_type =  "uw_student_courseavailable"
            message.content = course_available_event.json_data()
            self.assertEquals(message.content['Event']['Section']['SectionID'], 'AA')
            self.assertEquals(message.content['Event']['Section']['Course']['CurriculumAbbreviation'], 'CSE')
            self.assertEquals(message.content['Event']['NotificationMsg0'], ' NO')

            nws = NWS()
            response_status = nws.create_new_message(message)
            self.assertEquals(response_status, 200)
Exemplo n.º 14
0
 def _channel_channel_id_live(self):
     with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                        'restclients.dao_implementation.nws.Live'):
         nws = NWS()
         channel = nws.get_channel_by_channel_id(
             "ce1d46fe-1cdf-4c5a-a316-20f6c99789b7")
         self.assertTrue(channel is not None)
Exemplo n.º 15
0
 def test_subscriptions_channel_id(self):
     with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                        'restclients.dao_implementation.nws.File'):
         nws = NWS()
         subscriptions = nws.get_subscriptions_by_channel_id(
             "b779df7b-d6f6-4afb-8165-8dbe6232119f")
         self.assertEquals(len(subscriptions), 5)
Exemplo n.º 16
0
 def _subscription_channel_id_live(self):
     with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                        'restclients.dao_implementation.nws.Live'):
         nws = NWS()
         subscriptions = nws.get_subscriptions_by_channel_id(
             "ce1d46fe-1cdf-4c5a-a316-20f6c99789b8")
         self.assertTrue(len(subscriptions) > 0)
Exemplo n.º 17
0
 def test_person_by_uwregid(self):
     with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                        'restclients.dao_implementation.nws.File'):
         nws = NWS()
         person = nws.get_person_by_uwregid(
             "9136CCB8F66711D5BE060004AC494FFE")
         self._assert_person_matches(person)
Exemplo n.º 18
0
    def test_create_message_with_json(self):
        with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                           'restclients.dao_implementation.nws.File'):

            json = {
                "Event": {
                    "EventID": "blah",
                    "Href": "",
                    "LastModified": "2012-12-23T09:00:00",
                    "Section": {
                        "Course": {
                            "CourseNumber": "100",
                            "CurriculumAbbreviation": "cse",
                            "Quarter": "winter",
                            "Year": 2012
                        },
                        "Href": "",
                        "SLN": "12345",
                        "SectionID": "aa"
                    },
                    "SpaceAvailable": 1
                }
            }

            message = Message()
            message.message_type = "uw_student_courseavailable"
            message.content = json

            nws = NWS()
            response_status = nws.create_new_message(message)
            self.assertEquals(response_status, 200)
Exemplo n.º 19
0
 def _delete_subscription_live(self):
     with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                        'restclients.dao_implementation.nws.Live'):
         nws = NWS()
         response_status = nws.delete_subscription(
             "6445864b-6d1c-47b7-a409-279ba4a4ccf4")
         self.assertEquals(response_status, 204)
Exemplo n.º 20
0
    def test_subscriber_id_validation(self):
        nws = NWS()
        nws._validate_subscriber_id('javerage')
        nws._validate_subscriber_id('*****@*****.**')

        self.assertRaises(InvalidNetID, nws._validate_subscriber_id, '00ok')
        self.assertRaises(InvalidNetID, nws._validate_subscriber_id, 'ok123456789')
        self.assertRaises(InvalidNetID, nws._validate_subscriber_id, '*****@*****.**')
        self.assertRaises(InvalidNetID, nws._validate_subscriber_id, 'javerage@')
Exemplo n.º 21
0
    def test_endpoint_search_by_subscriber_id(self):
        with self.settings(
                RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
            nws = NWS()
            endpoints = nws.get_endpoints_by_subscriber_id("javerage")
            self.assertEquals(len(endpoints), 2)

            endpoint = endpoints[0]
            self._assert_endpoint_matches(endpoint)
Exemplo n.º 22
0
    def test_create_endpoint(self):
        with self.settings(
                RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
            nws = NWS()
            endpoint = nws.get_endpoint_by_endpoint_id("780f2a49-2118-4969-9bef-bbd38c26970a")
            endpoint.endpoint_id = None
            endpoint.endpoint_uri = None

            self.assertRaises(DataFailureException, nws.create_endpoint, endpoint)
Exemplo n.º 23
0
    def test_endpoint_search_by_subscriber_id(self):
        with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                           'restclients.dao_implementation.nws.File'):
            nws = NWS()
            endpoints = nws.get_endpoints_by_subscriber_id("javerage")
            self.assertEquals(len(endpoints), 2)

            endpoint = endpoints[0]
            self._assert_endpoint_matches(endpoint)
Exemplo n.º 24
0
    def test_create_person(self):
        with self.settings(
                RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
            nws = NWS()
            person = nws.get_person_by_surrogate_id("*****@*****.**")
            person.person_id = None
            person.endpoints = None

            response_status = nws.create_new_person(person)
            self.assertEquals(201, response_status)
Exemplo n.º 25
0
    def test_create_person(self):
        with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                           'restclients.dao_implementation.nws.File'):
            nws = NWS()
            person = nws.get_person_by_surrogate_id("*****@*****.**")
            person.person_id = None
            person.endpoints = None

            response_status = nws.create_new_person(person)
            self.assertEquals(201, response_status)
Exemplo n.º 26
0
    def test_create_endpoint(self):
        with self.settings(
                RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
            nws = NWS()
            endpoint = nws.get_endpoint_by_endpoint_id("780f2a49-2118-4969-9bef-bbd38c26970a")
            endpoint.endpoint_id = None
            endpoint.endpoint_uri = None

            response_status = nws.create_new_endpoint(endpoint)
            self.assertEquals(201, response_status)
Exemplo n.º 27
0
    def test_create_endpoint(self):
        with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                           'restclients.dao_implementation.nws.File'):
            nws = NWS()
            endpoint = nws.get_endpoint_by_endpoint_id(
                "780f2a49-2118-4969-9bef-bbd38c26970a")
            endpoint.endpoint_id = None
            endpoint.endpoint_uri = None

            response_status = nws.create_new_endpoint(endpoint)
            self.assertEquals(201, response_status)
Exemplo n.º 28
0
    def test_create_channel(self):
        with self.settings(
                RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
            channel = Channel()
            channel.surrogate_id = "2012,autumn,uwit,100,a"
            channel.type =  "uw_student_courseavailable"
            channel.name = "TEST CREATE CHANNEL"
            channel.description = "TEST CREATE CHANNEL \n"

            nws = NWS()
            response_status = nws.create_new_channel(channel)
            self.assertEquals(response_status, 201)
Exemplo n.º 29
0
    def test_create_channel(self):
        with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                           'restclients.dao_implementation.nws.File'):
            channel = Channel()
            channel.surrogate_id = "2012,autumn,uwit,100,a"
            channel.type = "uw_student_courseavailable"
            channel.name = "TEST CREATE CHANNEL"
            channel.description = "TEST CREATE CHANNEL \n"

            nws = NWS()
            response_status = nws.create_new_channel(channel)
            self.assertEquals(response_status, 201)
Exemplo n.º 30
0
    def test_terms_with_active_channels(self):
        with self.settings(
                RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File',
                RESTCLIENTS_SWS_DAO_CLASS='restclients.dao_implementation.sws.File'):
            nws = NWS()

            terms = nws.get_terms_with_active_channels("uw_student_courseavailable")
            self.assertEquals(len(terms), 2)

            self.assertEquals(terms[0].year, 2013)
            self.assertEquals(terms[0].quarter, 'spring')
            self.assertEquals(terms[1].year, 2013)
            self.assertEquals(terms[1].quarter, 'summer')
Exemplo n.º 31
0
    def _create_channel_live(self):
        with self.settings(
                RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.Live'):
            channel = Channel()
            channel.channel_id = "ce1d46fe-1cdf-4c5a-a316-20f6c99789b7"
            channel.surrogate_id = "2012,autumn,uwit,100,a"
            channel.type =  "uw_student_courseavailable"
            channel.name = "TEST CREATE CHANNEL"
            channel.template_surrogate_id = "CourseAvailableNotificationTemplate"
            channel.description = "TEST CREATE CHANNEL \n"

            nws = NWS()
            response_status = nws.create_new_channel(channel)
            self.assertEquals(response_status, 201)
Exemplo n.º 32
0
    def _create_channel_live(self):
        with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                           'restclients.dao_implementation.nws.Live'):
            channel = Channel()
            channel.channel_id = "ce1d46fe-1cdf-4c5a-a316-20f6c99789b7"
            channel.surrogate_id = "2012,autumn,uwit,100,a"
            channel.type = "uw_student_courseavailable"
            channel.name = "TEST CREATE CHANNEL"
            channel.template_surrogate_id = "CourseAvailableNotificationTemplate"
            channel.description = "TEST CREATE CHANNEL \n"

            nws = NWS()
            response_status = nws.create_new_channel(channel)
            self.assertEquals(response_status, 201)
Exemplo n.º 33
0
    def _update_subscription_live(self):
        with self.settings(
                RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.Live'):
            subscription = Subscription()
            subscription.subscription_id = "6445864b-6d1c-47b7-a409-279ba4a4ccf4"
            subscription.end_point = "*****@*****.**"
            subscription.protocol = "Email"
            subscription.subscriber_id = "javerage"
            subscription.channel_id = "ce1d46fe-1cdf-4c5a-a316-20f6c99789b8"
            subscription.owner = "javerage"
            #subscription.subscriber_type = "Individual"

            nws = NWS()
            response_status = nws.update_subscription(subscription)
            self.assertEquals(response_status, 204)
Exemplo n.º 34
0
    def _update_subscription_live(self):
        with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                           'restclients.dao_implementation.nws.Live'):
            subscription = Subscription()
            subscription.subscription_id = "6445864b-6d1c-47b7-a409-279ba4a4ccf4"
            subscription.end_point = "*****@*****.**"
            subscription.protocol = "Email"
            subscription.subscriber_id = "javerage"
            subscription.channel_id = "ce1d46fe-1cdf-4c5a-a316-20f6c99789b8"
            subscription.owner_id = "javerage"
            #subscription.subscriber_type = "Individual"

            nws = NWS()
            response_status = nws.update_subscription(subscription)
            self.assertEquals(response_status, 204)
Exemplo n.º 35
0
    def test_terms_with_active_channels(self):
        with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                           'restclients.dao_implementation.nws.File',
                           RESTCLIENTS_SWS_DAO_CLASS=
                           'restclients.dao_implementation.sws.File'):
            nws = NWS()

            terms = nws.get_terms_with_active_channels(
                "uw_student_courseavailable")
            self.assertEquals(len(terms), 2)

            self.assertEquals(terms[0].year, 2013)
            self.assertEquals(terms[0].quarter, 'spring')
            self.assertEquals(terms[1].year, 2013)
            self.assertEquals(terms[1].quarter, 'summer')
Exemplo n.º 36
0
 def test_delete_invalid_subscription(self):
     with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                        'restclients.dao_implementation.nws.File'):
         nws = NWS()
         #Invalid UUID - missing the last character
         self.assertRaises(InvalidUUID, nws.delete_subscription,
                           "652236c6-a85a-4845-8dc5-3e518bec044")
Exemplo n.º 37
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)
Exemplo n.º 38
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)
Exemplo n.º 39
0
    def _create_message_live_with_model(self):
        with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                           'restclients.dao_implementation.nws.Live'):
            course_available_event = CourseAvailableEvent()
            course_available_event.event_id = "blah"
            course_available_event.last_modified = "2012-12-23T09:00:00"
            course_available_event.status = "open"
            course_available_event.space_available = 1
            course_available_event.quarter = "autumn"
            course_available_event.year = 2012
            course_available_event.curriculum_abbr = "ling"
            course_available_event.course_number = "200"
            course_available_event.section_id = "ac"
            course_available_event.sln = "16116"

            message = Message()
            message.message_type = "uw_student_courseavailable"
            message.content = course_available_event.json_data()

            nws = NWS()
            response_status = nws.create_new_message(message)
            self.assertEquals(response_status, 200)
Exemplo n.º 40
0
    def _create_message_live_with_model(self):
        with self.settings(
                RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.Live'):
            course_available_event = CourseAvailableEvent()
            course_available_event.event_id = "blah"
            course_available_event.last_modified = "2012-12-23T09:00:00"
            course_available_event.status = "open"
            course_available_event.space_available = 1
            course_available_event.quarter = "autumn"
            course_available_event.year = 2012
            course_available_event.curriculum_abbr = "ling"
            course_available_event.course_number = "200"
            course_available_event.section_id = "ac"
            course_available_event.sln = "16116"

            message = Message()
            message.message_type =  "uw_student_courseavailable"
            message.content = course_available_event.json_data()

            nws = NWS()
            response_status = nws.create_new_message(message)
            self.assertEquals(response_status, 200)
Exemplo n.º 41
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)
Exemplo n.º 42
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)
Exemplo n.º 43
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)
Exemplo n.º 44
0
    def test_subscriber_id_validation(self):
        nws = NWS()
        nws._validate_subscriber_id('javerage')
        nws._validate_subscriber_id('*****@*****.**')

        self.assertRaises(InvalidNetID, nws._validate_subscriber_id, '00ok')
        self.assertRaises(InvalidNetID, nws._validate_subscriber_id,
                          'ok123456789')
        self.assertRaises(InvalidNetID, nws._validate_subscriber_id,
                          '*****@*****.**')
        self.assertRaises(InvalidNetID, nws._validate_subscriber_id,
                          'javerage@')
Exemplo n.º 45
0
 def test_subscriptions_subscriber_id(self):
     with self.settings(
             RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
         nws = NWS()
         subscriptions = nws.get_subscriptions_by_subscriber_id("javerage", "10")
         self.assertEquals(len(subscriptions), 5)
Exemplo n.º 46
0
 def test_channel_surrogate_id(self):
     with self.settings(
             RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
         nws = NWS()
         channel = nws.get_channel_by_surrogate_id("uw_student_courseavailable", "2012,autumn,cse,100,w")
         self._assert_channel(channel)
Exemplo n.º 47
0
 def test_person_by_surrogate_id_nonexistent(self):
     with self.settings(RESTCLIENTS_NWS_DAO_CLASS=
                        'restclients.dao_implementation.nws.File'):
         nws = NWS()
         self.assertRaises(DataFailureException,
                           nws.get_person_by_surrogate_id, "asdfgh")
Exemplo n.º 48
0
 def test_channel_sln_and_term(self):
     with self.settings(
             RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
         nws = NWS()
         channels = nws.get_channels_by_sln_year_quarter("uw_student_courseavailable", "12345", 2012, "autumn")
         self.assertEquals(len(channels), 1)
Exemplo n.º 49
0
 def test_channel_channel_id(self):
     with self.settings(
             RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
         nws = NWS()
         channel = nws.get_channel_by_channel_id("b779df7b-d6f6-4afb-8165-8dbe6232119f")
         self._assert_channel(channel)
Exemplo n.º 50
0
 def _delete_channel_live(self):
     with self.settings(
             RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.Live'):
         nws = NWS()
         response_status = nws.delete_channel("ce1d46fe-1cdf-4c5a-a316-20f6c99789b7")
         self.assertEquals(response_status, 204)
Exemplo n.º 51
0
 def _channel_channel_id_live(self):
     with self.settings(
             RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.Live'):
         nws = NWS()
         channel = nws.get_channel_by_channel_id("ce1d46fe-1cdf-4c5a-a316-20f6c99789b7")
         self.assertTrue(channel is not None)
Exemplo n.º 52
0
 def test_endpoint_endpoint_id(self):
     with self.settings(
             RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
         nws = NWS()
         endpoint = nws.get_endpoint_by_endpoint_id("780f2a49-2118-4969-9bef-bbd38c26970a")
         self._assert_endpoint_matches(endpoint)
Exemplo n.º 53
0
 def test_subscriptions_channel_id(self):
     with self.settings(
             RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
         nws = NWS()
         subscriptions = nws.get_subscriptions_by_channel_id("b779df7b-d6f6-4afb-8165-8dbe6232119f")
         self.assertEquals(len(subscriptions), 5)
Exemplo n.º 54
0
 def _delete_subscription_live(self):
     with self.settings(
             RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.Live'):
         nws = NWS()
         response_status = nws.delete_subscription("6445864b-6d1c-47b7-a409-279ba4a4ccf4")
         self.assertEquals(response_status, 204)
Exemplo n.º 55
0
 def _subscription_channel_id_live(self):
     with self.settings(
             RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.Live'):
         nws = NWS()
         subscriptions = nws.get_subscriptions_by_channel_id("ce1d46fe-1cdf-4c5a-a316-20f6c99789b8")
         self.assertTrue(len(subscriptions) > 0)
Exemplo n.º 56
0
 def test_delete_subscription(self):
     with self.settings(
             RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
         nws = NWS()
         response_status = nws.delete_subscription("652236c6-a85a-4845-8dc5-3e518bec044c")
         self.assertEquals(response_status, 204)
Exemplo n.º 57
0
 def test_endpoint_search_by_endpoint_address(self):
     with self.settings(
             RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
         nws = NWS()
         endpoint = nws.get_endpoint_by_address("222-222-3333")
         self._assert_endpoint_matches(endpoint)
Exemplo n.º 58
0
 def test_endpoint_by_subscriber_id_protocol(self):
     with self.settings(
             RESTCLIENTS_NWS_DAO_CLASS='restclients.dao_implementation.nws.File'):
         nws = NWS()
         endpoint = nws.get_endpoint_by_subscriber_id_and_protocol("javerage", "sms")
         self._assert_endpoint_matches(endpoint)