Example #1
0
    def test_from_config_preseeded_mdTrue(self, m_confFromConfig):
        """
        Test that parameters provided at runtime prevails over any provided
        through a given config.
        """
        given_conf = {
            "type_name": "should not get through",
            "uuid": "should not get through",
        }
        expected_typename = 'actually expected typename'
        expected_uuid = 'actually expected uuid'
        expected_conf = {
            'type_name': expected_typename,
            'uuid': expected_uuid,
        }
        expected_return = 'sim return from parent'
        m_confFromConfig.return_value = expected_return

        r = ClassificationElement.from_config(given_conf,
                                              expected_typename,
                                              expected_uuid,
                                              merge_default=True)

        m_confFromConfig.assert_called_once_with(expected_conf,
                                                 merge_default=True)
        assert r == expected_return
Example #2
0
    def test_from_config_mdTrue(self, m_confFromConfig):
        """
        Test that ``from_config`` appropriately passes runtime provided
        parameters.
        """
        given_conf = {}
        expected_typename = 'ex typename'
        expected_uuid = 'ex uuid'
        expected_conf = {
            'type_name': expected_typename,
            'uuid': expected_uuid,
        }
        expected_return = 'sim return from parent'

        m_confFromConfig.return_value = expected_return

        r = ClassificationElement.from_config(given_conf,
                                              expected_typename,
                                              expected_uuid,
                                              merge_default=True)

        m_confFromConfig.assert_called_once_with(expected_conf,
                                                 merge_default=True)
        assert r == expected_return