Esempio n. 1
0
 def test_form_update_sheet(self):
     owner = User.objects.create()
     TxSheet.objects.create(owner=owner, name='Freddy', comment='Mercury')
     defaults = {'name': 'David', 'comment': 'Bowie'}
     TxSheetForm.update(sheet_id=1, defaults=defaults)
     sheet = TxSheet.objects.first()
     self.assertEqual(sheet.name, 'David')
     self.assertEqual(sheet.comment, 'Bowie')
Esempio n. 2
0
    def test_form_save_sheet(self):
        owner = User.objects.create()

        form = TxSheetForm(data={
            'name': 'Poochy',
            'comment': 'Neuter'
        })

        form.is_valid()
        sheet = form.save(owner=owner)
        self.assertIsInstance(sheet, TxSheet)
Esempio n. 3
0
 def test_form_validation(self):
     drug = Mock(spec='treatment_sheets.forms.Prescription')
     form = TxSheetForm(data={
         'name': '',
         'comment': '',
         'med': drug,
         'dose': '',
         'freq': '',
         'unit': ''
     })
     self.assertFalse(form.is_valid())