def test_form_no_catalogs(self): """ Test clean method on form that has no catalogs set """ form = EnterpriseCustomerReportingConfigAdminForm( data=self.form_data, ) assert form.is_valid()
def test_form_catalogs_different_entcustomer_only(self): """ Clean should throw errors about catalogs if catalogs selected have different enterprise customer as reporting config """ self.form_data['enterprise_customer_catalogs'] = self.ent_catalogs2 form = EnterpriseCustomerReportingConfigAdminForm( data=self.form_data, ) assert not form.is_valid()
def test_form_catalogs_mixed_entcustomer(self): """ Clean should throw errors about catalogs if catalogs selected have a mix of enterprise customers, at least one of which matches the config reporting object """ self.form_data['enterprise_customer_catalogs'] = (self.ent_catalogs1 + self.ent_catalogs2) form = EnterpriseCustomerReportingConfigAdminForm( data=self.form_data, ) assert not form.is_valid()