def test_rest_calls_value_for_inputfield(self):
        field_value = 3
        inputfield = InputFieldF.build(type=InputField.TYPE_INTEGER)

        with mock.patch("flooding_lib.models.Scenario.value_for_inputfield", return_value=field_value) as patched:
            headers = ({}, {"inputfield": inputfield})
            scenariorow = eie.ScenarioRow(ScenarioF.build(), headers)

            columns = scenariorow.columns()
            columns.next()  # Skip scenario id
            self.assertEquals(columns.next().value, field_value)
            patched.assert_called_with(inputfield)
Example #2
0
    def test_rest_calls_value_for_inputfield(self):
        field_value = 3
        inputfield = InputFieldF.build(type=InputField.TYPE_INTEGER)

        with mock.patch('flooding_lib.models.Scenario.value_for_inputfield',
                        return_value=field_value) as patched:
            headers = ({}, {'inputfield': inputfield})
            scenariorow = eie.ScenarioRow(ScenarioF.build(), headers)

            columns = scenariorow.columns()
            columns.next()  # Skip scenario id
            self.assertEquals(columns.next().value, field_value)
            patched.assert_called_with(inputfield)
Example #3
0
    def test_scenarios(self):
        scenario = ScenarioF.build()
        fieldinfo = eie.FieldInfo([scenario])

        for s in fieldinfo.scenarios():
            self.assertTrue(s is scenario)
    def test_scenarios(self):
        scenario = ScenarioF.build()
        fieldinfo = eie.FieldInfo([scenario])

        for s in fieldinfo.scenarios():
            self.assertTrue(s is scenario)