Test coverage report: ftp_deploy.models.notification

# ftp_deploy.models.notification: 39 total statements, 100.0% covered

Generated: Thu 2013-12-19 21:13 GMT

Source file: /var/www/service.dev/service/ftp_deploy/models/notification.py

Stats: 36 executed, 0 missed, 3 excluded, 14 ignored

1. `from django.db import models`
2. ``
3. ``
4. `class Notification(models.Model):`
5. `name = models.CharField(max_length=200, unique=True)`
6. `success = models.TextField(blank=True)`
7. `fail = models.TextField(blank=True)`
8. `commit_user = models.CharField('Commit User', max_length=50, blank=True)`
9. `deploy_user = models.CharField('Deploy User', max_length=50, blank=True)`
10. `created = models.DateTimeField(auto_now_add=True)`
11. `updated = models.DateTimeField(auto_now=True)`
12. ``
13. `def __unicode__(self):`
14. `return self.name`
15. ``
16. `def get_email_list(self):`
17. `emails = dict()`
18. ``
19. `for email in self.get_success():`
20. `emails[email] = dict()`
21. `emails[email]['success'] = True`
22. ``
23. `for email in self.get_fail():`
24. `try:`
25. `emails[email]['fail'] = True`
26. `except KeyError, e:`
27. `emails[email] = dict()`
28. `emails[email]['fail'] = True`
29. ``
30. `return emails`
31. ``
32. `def get_success(self):`
33. `return filter(None, self.success.split(','))`
34. ``
35. `def get_fail(self):`
36. `return filter(None, self.fail.split(','))`
37. ``
38. `def commit_user_success(self):`
39. `return True if '0' in self.commit_user else False`
40. ``
41. `def commit_user_fail(self):`
42. `return True if '1' in self.commit_user else False`
43. ``
44. `def deploy_user_success(self):`
45. `return True if '0' in self.deploy_user else False`
46. ``
47. `def deploy_user_fail(self):`
48. `return True if '1' in self.deploy_user else False`
49. ``
50. `class Meta:`
51. `ordering = ('name',)`
52. `app_label = 'ftp_deploy'`
53. `db_table = 'ftp_deploy_notification'`