Test coverage report: ftp_deploy.server.forms.service

# ftp_deploy.server.forms.service: 33 total statements, 100.0% covered

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

Source file: /var/www/service.dev/service/ftp_deploy/server/forms/service.py

Stats: 27 executed, 0 missed, 6 excluded, 45 ignored

1. `from django import forms`
2. `from django.core.urlresolvers import reverse`
3. ``
4. `from crispy_forms.helper import FormHelper`
5. `from crispy_forms.bootstrap import FormActions`
6. `from crispy_forms.layout import Layout, Fieldset, Field, Submit, Div`
7. ``
8. `from ftp_deploy.models import Service`
9. ``
10. ``
11. `class ServiceForm(forms.ModelForm):`
12. ``
13. `"""Add/Edit service form"""`
14. ``
15. `def __init__(self, *args, **kwargs):`
16. `super(ServiceForm, self).__init__(*args, **kwargs)`
17. `self.helper = FormHelper()`
18. `self.helper.form_id = 'service-form'`
19. `self.helper.form_class = 'form-horizontal'`
20. `self.helper.label_class = 'col-sm-3'`
21. `self.helper.field_class = 'col-sm-9'`
22. `self.helper.html5_required = True`
23. ``
24. `self.helper.layout = Layout(`
25. `Fieldset('FTP Settings',`
26. `'ftp_host',`
27. `'ftp_username',`
28. `'ftp_password',`
29. `'ftp_path'`
30. `),`
31. `Fieldset('Repository',`
32. `Field('repo_source', data_action=reverse('ftpdeploy_bb_api', args=(0,))),`
33. `'repo_name',`
34. `'repo_slug_name',`
35. `'repo_branch'`
36. `),`
37. `Fieldset('Notification',`
38. `'notification'`
39. `),`
40. `Fieldset('Security',`
41. `'secret_key'`
42. `),`
43. `Div(`
44. `Div(`
45. `Submit('save', 'Submit', css_class='pull-right'),`
46. `css_class='col-sm-12'`
47. `),`
48. `css_class='row'`
49. `)`
50. ``
51. `)`
52. ``
53. `class Meta:`
54. `model = Service`
55. `exclude = ['status', 'status_date', 'status_message']`
56. `widgets = {`
57. `'ftp_password': forms.PasswordInput(render_value=True),`
58. `}`
59. ``
60. ``
61. `class ServiceNotificationForm(forms.ModelForm):`
62. ``
63. `def __init__(self, *args, **kwargs):`
64. `super(ServiceNotificationForm, self).__init__(*args, **kwargs)`
65. `self.helper = FormHelper()`
66. `self.helper.form_id = 'notification-form'`
67. `self.helper.form_class = 'form-horizontal'`
68. `self.helper.label_class = 'hide'`
69. `self.helper.field_class = 'col-sm-12'`
70. `self.helper.form_tag = False`
71. ``
72. `self.helper.layout = Layout(`
73. `'notification'`
74. `)`
75. ``
76. `class Meta:`
77. `model = Service`
78. `fields = ['notification']`