Test coverage report: ftp_deploy.admin

# ftp_deploy.admin: 26 total statements, 87.0% covered

Generated: Mon 2013-12-16 18:43 GMT

Source file: /var/www/service.dev/service/ftp_deploy/admin.py

Stats: 20 executed, 3 missed, 3 excluded, 28 ignored

1. `from django.contrib import admin`
2. ``
3. `from .models import Log, Service, Notification`
4. `from ftp_deploy.server.forms import NotificationForm`
5. ``
6. `class ServiceAdmin(admin.ModelAdmin):`
7. ``
8. `list_display = ('repo_name', 'repo_branch', 'hook_url', 'status_message_html', 'status')`
9. `fieldsets = (`
10. `('FTP Settings', {`
11. `'fields': ('ftp_host', ('ftp_username', 'ftp_password'), 'ftp_path')`
12. `}),`
13. `('Repository', {`
14. `'classes': ('',),`
15. `'fields': ('repo_source', 'repo_name', 'repo_branch')`
16. `}),`
17. `('Security', {`
18. `'classes': ('collapse',),`
19. `'fields': ('secret_key',)`
20. `}),`
21. `)`
22. ``
23. `def status_message_html(self, obj):`
24. `return obj.status_message`
25. `status_message_html.allow_tags = True`
26. `status_message_html.short_description = 'Status Message'`
27. ``
28. ``
29. `class LogAdmin(admin.ModelAdmin):`
30. `list_display = ('id', 'created', 'user', 'status_message_html', 'status')`
31. `readonly_fields = ('service', 'created', 'user', 'status','status_message_html')`
32. `exclude = ('payload',)`
33. ``
34. `def has_add_permission(self, request):`
35. `return False`
36. ``
37. `def status_message_html(self, obj):`
38. `return obj.status_message`
39. `status_message_html.allow_tags = True`
40. `status_message_html.short_description = 'Status Message'`
41. ``
42. ``
43. ``
44. `class NotificationAdmin(admin.ModelAdmin):`
45. `form = NotificationForm`
46. `list_display = ('name',)`
47. ``
48. ``
49. ``
50. `admin.site.register(Notification, NotificationAdmin)`
51. ``
52. ``
53. `admin.site.register(Service, ServiceAdmin)`
54. `admin.site.register(Log, LogAdmin)`