Ejemplo n.º 1
0
 def test_shortOptionParsing(self):
     """
     Test that the short form of all the supported command line options are
     parsed correctly.
     """
     opt = webcmd.WebConfiguration()
     opt.parent = self
     certFile = self.store.filesdir.child('name')
     opt.parseOptions(['-h', 'http.log', '-H', 'example.com'])
     self.assertEquals(opt['http-log'], 'http.log')
     self.assertEquals(opt['hostname'], 'example.com')
Ejemplo n.º 2
0
 def test_staticParsing(self):
     """
     Test that the --static option parses arguments of the form
     "url:filename" correctly.
     """
     opt = webcmd.WebConfiguration()
     opt.parent = self
     opt.parseOptions(
         ['--static', 'foo:bar', '--static', 'quux/fooble:/bar/baz'])
     self.assertEquals(opt.staticPaths, [('foo', os.path.abspath('bar')),
                                         ('quux/fooble', '/bar/baz')])
Ejemplo n.º 3
0
    def test_urchinKey(self):
        """
        Specifying a Google Analytics key inserts an item into the database
        recording it.
        """
        opt = webcmd.WebConfiguration()
        opt.parent = self
        opt['urchin-key'] = 'A123'
        opt.postOptions()

        self.assertEquals(
            APIKey.getKeyForAPI(self.store, APIKey.URCHIN).apiKey, u'A123')
Ejemplo n.º 4
0
    def test_hostname(self):
        """
        The I{hostname} option changes the C{hostname} attribute of the
        L{SiteConfiguration} object installed on the store.  The hostname
        cannot be set to the empty string.
        """
        opt = webcmd.WebConfiguration()
        opt.parent = self
        opt['hostname'] = 'example.com'
        opt.postOptions()

        opt['hostname'] = ''
        self.assertRaises(UsageError, opt.postOptions)

        self.assertEqual(
            self.store.findUnique(SiteConfiguration).hostname, u"example.com")
Ejemplo n.º 5
0
 def _list(self):
     wconf = webcmd.WebConfiguration()
     wconf.parent = self
     wout = _captureStandardOutput(wconf.parseOptions, ['--list'])
     return wout
Ejemplo n.º 6
0
 def setUp(self):
     self.store = Store()
     self.options = webcmd.WebConfiguration()
     self.options.parent = self