# Path: ethicsapplication/forms.py
# class EthicsApplicationForm(ModelForm):
#     class Meta:
#         model = EthicsApplication
#         exclude = ('principle_investigator','application_form', 'active', 'checklist')


from django.test import TestCase
from ethicsapplication.forms import EthicsApplicationForm

@author: jasonmarshall
'''

class FormsTest(TestCase):
    
    def test_EthicsApplication_form_title(self):
        '''
            Check that the form provdes a field that cannot be blank for the 
            application title
        '''
        form = EthicsApplicationForm()
        self.assertTrue('title' in form.fields)

    def test_EthicsApplication_form_ignored_fields(self):
        '''
            Check that the form does not display a field for either 
            Principle investigator, nor application nor the active flag.
        '''
        form = EthicsApplicationForm()
        self.assertFalse('principle_investigator' in form.fields)
        self.assertFalse('application_form' in form.fields)
        self.assertFalse('active' in form.fields)
        self.assertFalse('checklist' in form.fields)

    def test_EthicsApplication_form_title_must_be_present(self):
        '''
            The form must require a non blank string for the title field.
        '''
        incorrect_data = {'data': {'title': '',}}

# Path: ethicsapplication/forms.py
# class EthicsApplicationForm(ModelForm):
#     class Meta:
#         model = EthicsApplication
#         exclude = ('principle_investigator','application_form', 'active', 'checklist')


# Path: ethicsapplication/tests/forms.py
from django.test import TestCase
from ethicsapplication.forms import EthicsApplicationForm


@author: jasonmarshall
'''

class FormsTest(TestCase):
    
    def test_EthicsApplication_form_title(self):
        '''
            Check that the form provdes a field that cannot be blank for the 
            application title
        '''
        form = EthicsApplicationForm()
        self.assertTrue('title' in form.fields)

    def test_EthicsApplication_form_ignored_fields(self):
        '''
            Check that the form does not display a field for either 
            Principle investigator, nor application nor the active flag.
        '''
        form = EthicsApplicationForm()
        self.assertFalse('principle_investigator' in form.fields)
        self.assertFalse('application_form' in form.fields)
        self.assertFalse('active' in form.fields)
        self.assertFalse('checklist' in form.fields)

    def test_EthicsApplication_form_title_must_be_present(self):
        '''
            The form must require a non blank string for the title field.
        '''
        incorrect_data = {'data': {'title': '',}}

        form = EthicsApplicationForm(incorrect_data)