-
Notifications
You must be signed in to change notification settings - Fork 436
Add subscriptions #240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add subscriptions #240
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
A couple of minor nits then LGTM
all_subscriptions_xml = parsed_response.findall( | ||
'.//t:subscription', namespaces=ns) | ||
|
||
all_subscriptions = (SubscriptionItem._parse_element(x, ns) for x in all_subscriptions_xml) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just make this a list comprehension since you listify it anyway.
server_response = self.get_request(url, req_options) | ||
|
||
pagination_item = PaginationItem.from_response(server_response.content, self.parent_srv.namespace) | ||
print(server_response.content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the debug print :)
id_ = element.get('id', None) | ||
subject = element.get('subject', None) | ||
sub = cls(subject, schedule_id, user_id, target) | ||
sub._set_id(id_) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you have the id only settable via a private method? (If other Items do this to it's fine, just asking).
The other attributes are all available via __init__
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modeled it after the UserItem -- because when creating a new User you don't have an id.
Same goes for Subscription.
test/test_subscription.py
Outdated
self.assertEqual('Not Found Alert', subscription.subject) | ||
self.assertEqual('7617c389-cdca-4940-a66e-69956fcebf3e', subscription.schedule_id) | ||
|
||
def test_get_single_subscription(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_get_subscription_by_id
🚀 |
@RussTheAerialist says 🚀 |
Adding subscriptions!