Esempio n. 1
0
 def test_set_from_str(self):
     processor = processors.SetterInjection()
     processor.container = IocContainer()
     event = sample_event('tests.watson.di.support.SampleDependencyAware')
     event.params['definition']['setter'] = {'basic_setter': 'arg'}
     event.target = SampleDependencyAware()
     processor(event)
     assert event.target.value == 'arg'
Esempio n. 2
0
 def test_set_from_dict(self):
     processor = processors.SetterInjection()
     processor.container = IocContainer()
     event = sample_event('tests.watson.di.support.SampleDependencyAware')
     event.params['definition']['setter'] = {'basic_dict_setter': {'kw1': 'one', 'kw2': 'two'}}
     event.target = SampleDependencyAware()
     processor(event)
     assert event.target.kw1 == 'one'
     assert event.target.kw2 == 'two'