Пример #1
0
    def test_configure_domain_name_config(self):
        self.patch_object(handlers.hookenv, 'config')
        self.config.return_value = 'mydomain'

        domain = mock.MagicMock()

        handlers.configure_domain_name(domain)

        domain.domain_name.assert_called_with('mydomain')
 def test_configure_domain_name_config(self):
     self.patch(handlers.keystone_ldap, 'render_config')
     self.patch(handlers.hookenv, 'config')
     self.patch(handlers.hookenv, 'service_name')
     self.config.return_value = 'mydomain'
     self.service_name.return_value = 'keystone-ldap'
     domain = mock.MagicMock()
     handlers.configure_domain_name(domain)
     self.render_config.assert_called_with(domain.trigger_restart)
     domain.domain_name.assert_called_with('mydomain')
 def test_configure_domain_name_application(self):
     self.patch(handlers.keystone_ldap, 'render_config')
     self.patch(handlers.hookenv, 'config')
     self.patch(handlers.hookenv, 'service_name')
     self.patch(handlers.reactive, 'set_state')
     self.config.return_value = None
     self.service_name.return_value = 'keystone-ldap'
     domain = mock.MagicMock()
     handlers.configure_domain_name(domain)
     self.render_config.assert_called_with(domain.trigger_restart)
     domain.domain_name.assert_called_with('keystone-ldap')
     self.set_state.assert_called_once_with('domain-name-configured')
Пример #4
0
    def test_configure_domain_name_application(self):
        self.patch_object(handlers.hookenv, 'config')
        self.config.return_value = None

        self.patch_object(handlers.hookenv, 'service_name')
        self.service_name.return_value = 'keystone-ldap'

        self.patch_object(handlers.flags, 'set_flag')

        domain = mock.MagicMock()

        handlers.configure_domain_name(domain)

        domain.domain_name.assert_called_with('keystone-ldap')
        self.set_flag.assert_called_once_with('domain-name-configured')