def test_detects_no_sourcepackage_or_productseries(self): # Detect if no source package or productseries was selected. potemplate = self.factory.makePOTemplate() view = POTemplateAdminView(potemplate, LaunchpadTestRequest()) data = self._makeData(potemplate, distroseries=None, sourcepackagename=None, productseries=None) view.validate(data) self.assertEqual([u"Choose either a distribution release series or a project " u"release series."], view.errors)
def test_detects_domain_clash_on_productseries_change(self): # Detect changing to a productseries that already has a template with # the same translation domain. translation_domain = self.factory.getUniqueString() existing_potemplate = self.factory.makePOTemplate(translation_domain=translation_domain) new_series = existing_potemplate.productseries potemplate = self.factory.makePOTemplate(translation_domain=translation_domain) view = POTemplateAdminView(potemplate, LaunchpadTestRequest()) data = self._makeData(potemplate, productseries=new_series) view.validate(data) self.assertEqual([u"Series already has a template with that same domain."], view.errors)
def test_detects_no_sourcepackage_or_productseries(self): # Detect if no source package or productseries was selected. potemplate = self.factory.makePOTemplate() view = POTemplateAdminView(potemplate, LaunchpadTestRequest()) data = self._makeData(potemplate, distroseries=None, sourcepackagename=None, productseries=None) view.validate(data) self.assertEqual([ u'Choose either a distribution release series or a project ' u'release series.' ], view.errors)
def test_detects_name_clash_on_productseries_change(self): # Detect changing to a productseries that already has a template of # the same name. template_name = self.factory.getUniqueString() existing_potemplate = self.factory.makePOTemplate(name=template_name) new_series = existing_potemplate.productseries potemplate = self.factory.makePOTemplate(name=template_name) view = POTemplateAdminView(potemplate, LaunchpadTestRequest()) data = self._makeData(potemplate, productseries=new_series) view.validate(data) self.assertEqual( [u'Series already has a template with that same name.'], view.errors)
def test_detects_sourcepackage_and_productseries(self): # Detect if no source package or productseries was selected. potemplate = self.factory.makePOTemplate() sourcepackage = self.factory.makeSourcePackage() view = POTemplateAdminView(potemplate, LaunchpadTestRequest()) data = self._makeData( potemplate, distroseries=sourcepackage.distroseries, sourcepackagename=sourcepackage.sourcepackagename, productseries=potemplate.productseries) view.validate(data) self.assertEqual([ u'Choose a distribution release series or a project ' u'release series, but not both.' ], view.errors)
def test_detects_sourcepackage_and_productseries(self): # Detect if no source package or productseries was selected. potemplate = self.factory.makePOTemplate() sourcepackage = self.factory.makeSourcePackage() view = POTemplateAdminView(potemplate, LaunchpadTestRequest()) data = self._makeData( potemplate, distroseries=sourcepackage.distroseries, sourcepackagename=sourcepackage.sourcepackagename, productseries=potemplate.productseries, ) view.validate(data) self.assertEqual( [u"Choose a distribution release series or a project " u"release series, but not both."], view.errors )