示例#1
0
    def test_blank_hrs(self):
        """blank/null hrs become 0"""
        form_data = {
            'project': '2',
            'hours_spent': None,
        }

        form = TimecardObjectForm(form_data)
        self.assertFalse(form.is_valid())
        self.assertEqual(form.cleaned_data['hours_spent'], 0)
示例#2
0
    def test_blank_hrs(self):
        """blank/null hrs become 0"""
        form_data = {
            'project': '2',
            'hours_spent': None,
        }

        form = TimecardObjectForm(form_data)
        self.assertFalse(form.is_valid())
        self.assertEqual(form.cleaned_data['hours_spent'], 0)
示例#3
0
    def test_general_notes_field_strips_html(self):
        """tests that a timecard object with a notes field that has HTML in it
        strips the HTML before saving."""
        form_data = {
            'project': '2',
            'hours_spent': '40',
            'notes': '<strong>This is a <em>test</em>!</strong>'
        }

        form = TimecardObjectForm(form_data)
        self.assertTrue(form.is_valid())
        self.assertEqual(form.cleaned_data['notes'], 'This is a test!')
示例#4
0
    def test_general_notes_field_strips_html(self):
        """tests that a timecard object with a notes field that has HTML in it
        strips the HTML before saving."""
        form_data = {
            'project': '2',
            'hours_spent': '40',
            'notes': '<strong>This is a <em>test</em>!</strong>'
        }

        form = TimecardObjectForm(form_data)
        self.assertTrue(form.is_valid())
        self.assertEqual(form.cleaned_data['notes'], 'This is a test!')
示例#5
0
 def test_general_has_required_notes_field(self):
     """tests that a timecard object with a General entry that is missing an
     accompaning blank notes field is not valid"""
     form_data = {'project': '2', 'hours_spent': '40'}
     form = TimecardObjectForm(form_data)
     self.assertFalse(form.is_valid())
示例#6
0
 def test_add_wrong_project(self):
     """ Check that missing projects are rejected """
     form_data = {'project': '2323', 'hours_spent': '20'}
     form = TimecardObjectForm(form_data)
     self.assertFalse(form.is_valid())
示例#7
0
 def test_add_project(self):
     """ Test that existing projects can be added without errors """
     form_data = {'project': '1', 'hours_spent': '20'}
     form = TimecardObjectForm(form_data)
     self.assertTrue(form.is_valid())
示例#8
0
 def test_general_has_required_notes_field(self):
     """tests that a timecard object with a General entry that is missing an
     accompaning blank notes field is not valid"""
     form_data = {'project': '2', 'hours_spent': '40'}
     form = TimecardObjectForm(form_data)
     self.assertFalse(form.is_valid())
示例#9
0
 def test_add_wrong_project(self):
     """ Check that missing projects are rejected """
     form_data = {'project': '2323', 'hours_spent': '20'}
     form = TimecardObjectForm(form_data)
     self.assertFalse(form.is_valid())
示例#10
0
 def test_add_project(self):
     """ Test that existing projects can be added without errors """
     form_data = {'project': '1', 'hours_spent': '20'}
     form = TimecardObjectForm(form_data)
     self.assertTrue(form.is_valid())
示例#11
0
 def test_add_project(self):
   form_data = {'project': '1', "hours_spent": "20"}
   form = TimecardObjectForm(form_data)
   self.assertTrue(form.is_valid())
示例#12
0
 def test_add_project(self):
     form_data = {'project': '1', 'time_percentage': "50"}
     form = TimecardObjectForm(form_data)
     self.assertTrue(form.is_valid())