def test_form_saves_risks(self): created_experiment = ExperimentFactory.create_with_status( Experiment.STATUS_DRAFT) self.assertEqual(created_experiment.changes.count(), 1) data = self.valid_data.copy() form = ExperimentRisksForm(request=self.request, data=data, instance=created_experiment) self.assertTrue(form.is_valid()) experiment = form.save() self.assertFalse(experiment.risk_partner_related) self.assertTrue(experiment.risk_brand) self.assertTrue(experiment.risk_fast_shipped) self.assertTrue(experiment.risk_confidential) self.assertTrue(experiment.risk_release_population) self.assertTrue(experiment.risk_technical) self.assertEqual(experiment.risk_technical_description, data["risk_technical_description"]) self.assertEqual(experiment.risks, data["risks"]) self.assertEqual(experiment.testing, data["testing"]) self.assertEqual(experiment.test_builds, data["test_builds"]) self.assertEqual(experiment.qa_status, data["qa_status"]) self.assertEqual(experiment.changes.count(), 2)
def test_form_saves_risks(self): created_experiment = ExperimentFactory.create_with_status( Experiment.STATUS_DRAFT) data = { "risk_partner_related": True, "risk_brand": True, "risk_fast_shipped": True, "risk_confidential": True, "risk_release_population": True, "risks": "There are some risks", "testing": "Always be sure to test!", } form = ExperimentRisksForm(request=self.request, data=data, instance=created_experiment) self.assertTrue(form.is_valid()) experiment = form.save() self.assertTrue(experiment.risk_partner_related) self.assertTrue(experiment.risk_brand) self.assertTrue(experiment.risk_fast_shipped) self.assertTrue(experiment.risk_confidential) self.assertTrue(experiment.risk_release_population) self.assertEqual(experiment.risks, data["risks"]) self.assertEqual(experiment.testing, data["testing"])
def test_form_saves_risks(self): created_experiment = ExperimentFactory.create_with_status( Experiment.STATUS_DRAFT ) data = { "risk_partner_related": True, "risk_brand": True, "risk_fast_shipped": True, "risk_confidential": True, "risk_release_population": True, "risk_technical": True, "risk_technical_description": "It's complicated", "risks": "There are some risks", "testing": "Always be sure to test!", "test_builds": "Latest build", "qa_status": "It ain't easy being green", } form = ExperimentRisksForm( request=self.request, data=data, instance=created_experiment ) self.assertTrue(form.is_valid()) experiment = form.save() self.assertTrue(experiment.risk_partner_related) self.assertTrue(experiment.risk_brand) self.assertTrue(experiment.risk_fast_shipped) self.assertTrue(experiment.risk_confidential) self.assertTrue(experiment.risk_release_population) self.assertTrue(experiment.risk_technical) self.assertEqual( experiment.risk_technical_description, data["risk_technical_description"], ) self.assertEqual(experiment.risks, data["risks"]) self.assertEqual(experiment.testing, data["testing"]) self.assertEqual(experiment.test_builds, data["test_builds"]) self.assertEqual(experiment.qa_status, data["qa_status"])