def test_form_fail_missing_attribute_name(self):
     #missing attribute name
     form_data={'mobile':'91213809', 'address':'22 Nanyang Avenue, Singapore', 'age':20,
                'postalcode':'639810', 'email':'*****@*****.**'}
     form = SubscriberForm(form_data)
     self.assertEqual(form.is_valid(), False)
 def test_form_fail_incorrect_data_type(self):
     #Incorrect data type for age
     form_data={'name':'Shuvam Nandi', 'mobile':'91213809', 'nric':'K7275634', 'address':'22 Nanyang Avenue, Singapore', 'age':'20a',
                'postalcode':'639810', 'email':'*****@*****.**'}
     form = SubscriberForm(form_data)
     self.assertEqual(form.is_valid(), False)
 def test_form_fail_greater_attribute_length(self):
     #Attribute length greater than bound for postalcode
     form_data={'name':'Shuvam Nandi', 'mobile':'91213809', 'nric':'K7275634', 'address':'22 Nanyang Avenue, Singapore', 'age':20,
                'postalcode':'6398102', 'email':'*****@*****.**'}
     form = SubscriberForm(form_data)
     self.assertEqual(form.is_valid(), False)
 def test_form_pass(self):
     form_data={'name':'Shuvam Nandi', 'mobile':'91213809', 'nric':'K7275634', 'address':'22 Nanyang Avenue, Singapore', 'age':20,
                'postalcode':'639810', 'email':'*****@*****.**'}
     form = SubscriberForm(form_data)
     self.assertTrue(form.is_valid())
 def test_form_fail_missing_attribute_email(self):
     #missing attribute email
     form_data={'name':'Shuvam Nandi', 'mobile':'91213809', 'nric':'K7275634', 'address':'22 Nanyang Avenue, Singapore', 'age':20, 'postalcode':'639810'}
     form = SubscriberForm(form_data)
     self.assertEqual(form.is_valid(), False)
 def test_form_fail_missing_attribute_address(self):
     #missing attribute address
     form_data={'name':'Shuvam Nandi', 'mobile':'91213809', 'nric':'K7275634', 'age':20, 'postalcode':'639810', 'email':'*****@*****.**'}
     form = SubscriberForm(form_data)
     self.assertEqual(form.is_valid(), False)