def test_create_scenario(self): s1 = Scenario(user=self.user, name="My Scenario", input_target_boardfeet=2000, input_target_carbon=1, input_property=self.prop1, input_rxs={self.stand1.pk: self.rx1, self.stand2.pk: self.rx2}, ) s1.save() self.assertEquals(Scenario.objects.get(name="My Scenario").input_target_boardfeet, 2000.0)
def test_scenario_results(self): s1 = Scenario(user=self.user, name="My Scenario", input_target_boardfeet=2000, input_target_carbon=1, input_property=self.prop1, input_rxs={self.stand1.pk: self.rx1, self.stand2.pk: self.rx2}, ) s1.save() out = s1.output_property_metrics self.assertTrue(out.has_key("__all__"))
def test_json_results(self): s1 = Scenario(user=self.user, name="My Scenario", input_target_boardfeet=2000, input_target_carbon=1, input_property=self.prop1, input_rxs={self.stand1.pk: self.rx1, self.stand2.pk: self.rx2}, ) s1.save() geojson_link = ForestProperty.get_options().get_link('Property Scenarios') url = geojson_link.reverse(self.prop1) # not logged in yet response = self.client.get(url) self.assertEqual(response.status_code, 401, response.content) # now we log in self.client.login(username='******', password='******') response = self.client.get(url) self.assertEqual(response.status_code, 200, response.content)