def test_register_does_not_call_setitem_when_no_second_argument(self): c = MedleyContainer() provider = Mock(register=Mock()) with patch.object(c, '__setitem__') as setitem: c.register(provider) setitem.assert_not_called()
def test_register_sets_ids_from_second_argument(self): c = MedleyContainer() provider = Mock(register=Mock()) with patch.object(c, '__setitem__') as setitem: c.register(provider, { 'foo': self.foo, 'bar': self.bar, 'baz': self.baz }) self.assertEqual(setitem.call_count, 3)
def test_register_returns_c(self): c = MedleyContainer() provider = Mock(register=Mock()) self.assertEqual(c.register(provider), c)
def test_register_calls_provider_register(self): c = MedleyContainer() provider = Mock(register=Mock()) c.register(provider) provider.register.assert_called_with(c)