Skip to content
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

Subscription.save() fails on missed disabled_days #13

Open
litleleprikon opened this issue Dec 23, 2019 · 0 comments
Open

Subscription.save() fails on missed disabled_days #13

litleleprikon opened this issue Dec 23, 2019 · 0 comments
Assignees
Labels

Comments

@litleleprikon
Copy link
Contributor

System info

Python version:

3.7.5 (default, Nov  1 2019, 02:16:23)

Summary:

When call Subscription.save() method exception raises:

AttributeError                            Traceback (most recent call last)
 in 
----> 1 transfer(user, recipient_user)

 in transfer(moira_old_user, moira_new_user)
      8 
      9     for sub in subscriptions:
---> 10         moira_new_user.subscription.create(sub.tags, [old_to_new_contacts[c] for c in sub.contacts], sub.enabled, sub.throttling, sub.sched, sub.ignore_warnings, sub.ignore_recoverings, sub.plotting).save()
     11 
     12     for sub in subscriptions:

~/Library/Python/3.7/lib/python/site-packages/moira_client/models/subscription.py in save(self)
    164         if self._id:
    165             return self.update()
--> 166         self._send_request()
    167 
    168     def update(self):

~/Library/Python/3.7/lib/python/site-packages/moira_client/models/subscription.py in _send_request(self, subscription_id)
     79         for day in DAYS_OF_WEEK:
     80             day_info = {
---> 81                 'enabled': True if day not in self.disabled_days else False,
     82                 'name': day
     83             }

AttributeError: 'Subscription' object has no attribute 'disabled_days'
litleleprikon pushed a commit that referenced this issue Dec 23, 2019
Run pylint and fix it's issues in subscription.py and
test_subscriptions.py.

Relates #13
litleleprikon pushed a commit that referenced this issue Dec 23, 2019
Add test that calls Subscription.save() and expect that this method will
raise AttributeError.

Relates #13
litleleprikon pushed a commit that referenced this issue Dec 23, 2019
On saving subscription with days attribute in sched set to None
attribute error raised. Move disabled_days to be defined with any value
of days in sched.

Closes #13
@litleleprikon litleleprikon self-assigned this Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant