Exemplo n.º 1
0
    def test_instantiates_class_with_options(self, import_string):
        options = {'hello': 'world'}
        path = 'lol.FooBar'

        result = app.get_instance(path, options)

        import_string.assert_called_once_with(path)
        import_string.return_value.assert_called_once_with(**options)

        assert result == import_string.return_value.return_value
Exemplo n.º 2
0
    def test_instantiates_class_with_options(self, import_string):
        options = {'hello': 'world'}
        path = 'lol.FooBar'

        result = app.get_instance(path, options)

        import_string.assert_called_once_with(path)
        import_string.return_value.assert_called_once_with(**options)

        assert result == import_string.return_value.return_value
Exemplo n.º 3
0
 def test_raises_import_error_on_invalid_path(self, import_string):
     import_string.return_value = None
     with self.assertRaises(ImportError):
         app.get_instance('lol.FooBar', {})