本文整理汇总了Python中restclients.nws.NWS类的典型用法代码示例。如果您正苦于以下问题:Python NWS类的具体用法?Python NWS怎么用?Python NWS使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NWS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_person_by_uwregid
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))
示例2: test_create_message_with_model_closed
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)
示例3: test_create_message_with_json
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)
示例4: test_person_by_surrogate_id
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("[email protected]")
self._assert_person_matches(person)
self.assertEquals(2, len(person.endpoints))
示例5: test_subscriber_id_validation
def test_subscriber_id_validation(self):
nws = NWS()
nws._validate_subscriber_id('javerage')
nws._validate_subscriber_id('[email protected]')
self.assertRaises(InvalidNetID, nws._validate_subscriber_id, '00ok')
self.assertRaises(InvalidNetID, nws._validate_subscriber_id, 'ok123456789')
self.assertRaises(InvalidNetID, nws._validate_subscriber_id, '[email protected]')
self.assertRaises(InvalidNetID, nws._validate_subscriber_id, '[email protected]')
示例6: test_endpoint_search_by_subscriber_id
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)
示例7: test_create_endpoint
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)
示例8: test_create_person
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("[email protected]")
person.person_id = None
person.endpoints = None
response_status = nws.create_new_person(person)
self.assertEquals(201, response_status)
示例9: test_create_endpoint
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)
示例10: test_create_channel
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)
示例11: test_terms_with_active_channels
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')
示例12: _create_channel_live
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)
示例13: _update_subscription_live
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 = "[email protected]"
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)
示例14: test_update_subscription
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 = "[email protected]"
subscription.endpoint.protocol = "Email"
subscription.endpoint.subscriber_id = "[email protected]"
subscription.endpoint.owner = "[email protected]"
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)
示例15: _create_message_live_with_model
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)