Пример #1
0
    def test_public_http_properties_explicit_no_path(self):
        result = channel_public_http_properties(
            {'public_http': {
                'web_port': 2323
            }})

        self.assertEqual(result, None)
Пример #2
0
    def test_public_http_properties_explicit_disable(self):
        result = channel_public_http_properties({
            'public_http': {
                'enabled': False,
                'web_path': '/foo/bar',
                'web_port': 2323
            }
        })

        self.assertFalse(result['enabled'])
Пример #3
0
    def test_public_http_properties_explicit_disable(self):
        result = channel_public_http_properties({
            'public_http': {
                'enabled': False,
                'web_path': '/foo/bar',
                'web_port': 2323
            }
        })

        self.assertFalse(result['enabled'])
Пример #4
0
    def test_public_http_properties_implicit(self):
        result = channel_public_http_properties({
            'web_port': 2323,
            'web_path': '/foo/bar'
        })

        self.assertEqual(result, {
            'enabled': True,
            'web_path': '/foo/bar',
            'web_port': 2323
        })
Пример #5
0
    def test_public_http_properties_implicit(self):
        result = channel_public_http_properties({
            'web_port': 2323,
            'web_path': '/foo/bar'
        })

        self.assertEqual(result, {
            'enabled': True,
            'web_path': '/foo/bar',
            'web_port': 2323
        })
Пример #6
0
    def channel_started(self, channel):
        properties = channel_public_http_properties(channel._properties)

        if properties is not None and properties['enabled']:
            mkpath(self.config.locations_dir)

            write(self.get_location_path(channel.id),
                  self.get_location_config(properties))

            reload_nginx()

            self.configured_channels.add(channel.id)
Пример #7
0
    def channel_started(self, channel):
        properties = channel_public_http_properties(channel._properties)

        if properties is not None and properties['enabled']:
            mkpath(self.config.locations_dir)

            write(
                self.get_location_path(channel.id),
                self.get_location_config(properties))

            reload_nginx()

            self.configured_channels.add(channel.id)
Пример #8
0
    def test_public_http_properties_explicit_implicit_path(self):
        result = channel_public_http_properties({
            'config': {
                'web_path': '/foo/bar',
            },
            'public_http': {
                'web_port': 2323
            },
        })

        self.assertEqual(result, {
            'enabled': True,
            'web_path': '/foo/bar',
            'web_port': 2323
        })
Пример #9
0
    def test_public_http_properties_explicit(self):
        result = channel_public_http_properties({
            'web_path': '/baz/quux',
            'web_port': 2121,
            'public_http': {
                'web_path': '/foo/bar',
                'web_port': 2323,
            }
        })

        self.assertEqual(result, {
            'enabled': True,
            'web_path': '/foo/bar',
            'web_port': 2323
        })
Пример #10
0
    def test_public_http_properties_explicit(self):
        result = channel_public_http_properties({
            'web_path': '/baz/quux',
            'web_port': 2121,
            'public_http': {
                'web_path': '/foo/bar',
                'web_port': 2323,
            }
        })

        self.assertEqual(result, {
            'enabled': True,
            'web_path': '/foo/bar',
            'web_port': 2323
        })
Пример #11
0
 def test_public_http_properties_implicit_no_port(self):
     result = channel_public_http_properties({'web_path': '/foo/bar'})
     self.assertEqual(result, None)
Пример #12
0
 def channel_started(self, channel):
     log.msg('Channel started: %s, %s from %s' % (
         channel.id, channel_public_http_properties(channel._properties),
         channel._properties))
     return super(MessengerPlugin, self).channel_started(channel)
Пример #13
0
 def test_public_http_properties_implicit_no_path(self):
     result = channel_public_http_properties({'web_port': 2323})
     self.assertEqual(result, None)
Пример #14
0
 def test_public_http_properties_implicit_no_port(self):
     result = channel_public_http_properties({'web_path': '/foo/bar'})
     self.assertEqual(result, None)