当前位置: 首页>>代码示例>>Python>>正文


Python OUT.color_off方法代码示例

本文整理汇总了Python中WebappConfig.debug.OUT.color_off方法的典型用法代码示例。如果您正苦于以下问题:Python OUT.color_off方法的具体用法?Python OUT.color_off怎么用?Python OUT.color_off使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebappConfig.debug.OUT的用法示例。


在下文中一共展示了OUT.color_off方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_read_corrupt

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import color_off [as 别名]
    def test_read_corrupt(self):
        contents = Contents('/'.join((HERE, 'testfiles', 'contents')),
                            package = 'test', version = '1.1')

        OUT.color_off()
        contents.read()
        output = sys.stdout.getvalue().split('\n')
        self.assertEqual(output[12], '* Not enough entries.')
开发者ID:PPed72,项目名称:webapp-config,代码行数:10,代码来源:external.py

示例2: test_add_pretend

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import color_off [as 别名]
    def test_add_pretend(self):
        loc = '/'.join((HERE, 'testfiles', 'contents', 'app'))
        contents = Contents(loc, package = 'test', version = '1.0',
                            pretend = True)
        OUT.color_off()
        contents.add('file', 'config_owned', destination = loc, path = '/test1',
                     real_path = loc + '/test1', relative = True)

        output = sys.stdout.getvalue().strip('\n')
        self.assertEqual(output,
                       '*     pretending to add: file 1 config_owned "test1"')
开发者ID:PPed72,项目名称:webapp-config,代码行数:13,代码来源:external.py

示例3: test_remove_files

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import color_off [as 别名]
    def test_remove_files(self):
        OUT.color_off()
        contents = Contents('/'.join((HERE, 'testfiles', 'contents', 'app2')),
                            package = 'test', version = '1.0', pretend = True)
        contents.read()
        webrm = WebappRemove(contents, True, True)
        webrm.remove_files()

        output = sys.stdout.getvalue().split('\n')
        self.assertEqual(output[3], '*     pretending to remove: ' +
                         '/'.join((HERE, 'testfiles', 'contents', 'app2',
                                   'test3')))
开发者ID:PPed72,项目名称:webapp-config,代码行数:14,代码来源:external.py

示例4: test_list_installs

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import color_off [as 别名]
    def test_list_installs(self):
        OUT.color_off()
        db = WebappDB(root = '/'.join((HERE, 'testfiles', 'webapps')))

        db.listinstalls()
        output = sys.stdout.getvalue().split('\n')
        self.assertEqual(output[1], '/var/www/localhost/htdocs/horde')

        # Now test the verbosity:
        db = WebappDB(root = '/'.join((HERE, 'testfiles', 'webapps')),
                      verbose = True)
        db.listinstalls()
        output = sys.stdout.getvalue().split('\n')
        self.assertEqual(output[5], '* Installs for horde-3.0.5')
开发者ID:PPed72,项目名称:webapp-config,代码行数:16,代码来源:external.py

示例5: test_write

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import color_off [as 别名]
    def test_write(self):
        contents = Contents('/'.join((HERE, 'testfiles', 'contents')),
                            package = 'test', version = '1.0', pretend = True)
        OUT.color_off()
        contents.read()

        contents.write()
        output = sys.stdout.getvalue().split('\n')

        expected = '* Would have written content file ' + '/'.join((HERE,
                                                          'testfiles',
                                                          'contents',
                                                          '.webapp-test-1.0!'))
        self.assertEqual(output[0], expected)
开发者ID:PPed72,项目名称:webapp-config,代码行数:16,代码来源:external.py

示例6: test_how_to_update

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import color_off [as 别名]
    def test_how_to_update(self):
        OUT.color_off()
        pro = Protection('', 'horde', '3.0.5', 'portage')
        strange_htdocs = '/'.join(('/my', 'strange', 'htdocs', 'where', 'i',
                                   'installed', 'x'))
        pro.how_to_update([strange_htdocs])
        output = sys.stdout.getvalue().split('\n')

        self.assertEqual(output[3], '* CONFIG_PROTECT="' + strange_htdocs +
                                    '" etc-update')

        # Adding a virtual config protected directory:
        i = strange_htdocs.replace('/where/i/instaled/x', '')
        pro.config_protect += ' ' + i

        pro.how_to_update([strange_htdocs])
        output = sys.stdout.getvalue().split('\n')

        self.assertEqual(output[8], '* etc-update')
开发者ID:PPed72,项目名称:webapp-config,代码行数:21,代码来源:external.py

示例7: test_list_locations

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import color_off [as 别名]
    def test_list_locations(self):
        OUT.color_off()
        db = WebappDB(root = '/'.join((HERE, 'testfiles', 'webapps')))

        sorted_db = [i[1] for i in db.list_locations().items()]
        sorted_db.sort(key=lambda x: x[0]+x[1]+x[2])

        self.assertEqual(sorted_db[1], ['', 'gallery', '2.0_rc2'])

        # Now test with a specific package and version:
        db = WebappDB(root = '/'.join((HERE, 'testfiles', 'webapps')),
                      package = 'horde', version = '3.0.5')
        sorted_db = [i[1] for i in db.list_locations().items()]
        self.assertEqual(sorted_db, [['', 'horde', '3.0.5']])

        # Now test with an install file that doesn't exist:
        db = WebappDB(root = '/'.join((HERE, 'testfiles', 'webapps')),
                      package = 'nihil', version = '3.0.5')
        sorted_db = [i[1] for i in db.list_locations().items()]
        self.assertEqual(sorted_db, [])
开发者ID:PPed72,项目名称:webapp-config,代码行数:22,代码来源:external.py

示例8: test_add_rm

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import color_off [as 别名]
    def test_add_rm(self):
        OUT.color_off()
        db = WebappDB(root = '/'.join((HERE, 'testfiles', 'webapps')),
                      pretend = True, package = 'horde', version = '3.0.5')
        # Test adding:
        db.add('/'.join(('/screwy', 'wonky', 'foobar', 'horde', 'hierarchy')),
               user = 'me', group = 'me')
        output = sys.stdout.getvalue().split('\n')
        self.assertEqual(output[0], '* Pretended to append installation '\
                                    '/screwy/wonky/foobar/horde/hierarchy')

        # Test deleting a webapp that is actually in the database:
        db.remove('/'.join(('/var', 'www', 'localhost', 'htdocs', 'horde')))
        output = sys.stdout.getvalue().split('\n')
        self.assertEqual(output[6], '* ')

        # And now test deleting one that isn't:
        db.remove('/'.join(('/screwy', 'wonky', 'foobar', 'horde', 'hierarchy')))
        output = sys.stdout.getvalue().split('\n')
        self.assertEqual(output[11], '* 1124612110 root root '\
                                     '/var/www/localhost/htdocs/horde')
开发者ID:PPed72,项目名称:webapp-config,代码行数:23,代码来源:external.py

示例9: test_add

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import color_off [as 别名]
    def test_add(self):
        loc = '/'.join((HERE, 'testfiles', 'contents', 'app'))
        contents = Contents(loc, package = 'test', version = '1.0')
        OUT.color_off()
        contents.add('file', 'config_owned', destination = loc, path = '/test1',
                     real_path = loc + '/test1', relative = True)

        # Now trigger an error by adding a file that doesn't exist!
        contents.add('file', 'config_owned', destination = loc, path = '/test0',
                     real_path = loc + '/test0', relative = True)

        output = sys.stdout.getvalue().strip('\n')

        self.assertTrue('WebappConfig/tests/testfiles/contents/app/test0 to '\
                        'add it as installation content. This should not '\
                        'happen!' in output)

        # Test adding hardlinks:
        contents.add('hardlink', 'config_owned', destination = loc,
                     path = '/test2', real_path = loc + '/test2', relative = True)
        self.assertTrue('file 1 config_owned "test2" ' in contents.entry(loc +
                                                                      '/test2'))
        # Test adding dirs:
        contents.add('dir', 'default_owned', destination = loc, path = '/dir1',
                     real_path = loc + '/dir1', relative = True)
        self.assertTrue('dir 1 default_owned "dir1" ' in contents.entry(loc +
                                                                       '/dir1'))

        # Test adding symlinks:
        contents.add('sym', 'virtual', destination = loc, path = '/test3',
                     real_path = loc + '/test3', relative = True)
        self.assertTrue('sym 1 virtual "test3" ' in contents.entry(loc +
                                                                   '/test3'))

        # Printing out the db after adding these entries:
        contents.db_print()
        output = sys.stdout.getvalue().split('\n')
        self.assertTrue('file 1 config_owned "test1" ' in output[1])
开发者ID:PPed72,项目名称:webapp-config,代码行数:40,代码来源:external.py

示例10: test_mk

# 需要导入模块: from WebappConfig.debug import OUT [as 别名]
# 或者: from WebappConfig.debug.OUT import color_off [as 别名]
    def test_mk(self):
        OUT.color_off()
        contents = Contents('/'.join((HERE, 'testfiles', 'installtest')),
                            pretend = True)
        webrm = WebappRemove(contents, True, True)
        protect = Protection('', 'horde', '3.0.5', 'portage')
        source = WebappSource(root = '/'.join((HERE, 'testfiles',
                                             'share-webapps')),
                              category = '', package = 'installtest',
                              version = '1.0')
        source.read()
        source.ignore = ['.svn']

        webadd = WebappAdd('htdocs',
                           '/'.join((HERE, 'testfiles', 'installtest')),
                           {'dir': {'default-owned': ('root',
                                                      'root',
                                                      '0644')},
                            'file': {'virtual':      ('root',
                                                       'root',
                                                       '0644'),
                                     'server-owned': ('apache',
                                                      'apache',
                                                      '0660'),
                                     'config-owned': ('nobody',
                                                      'nobody',
                                                      '0600')}
                           },
                           {'content': contents,
                            'removal': webrm,
                            'protect': protect,
                            'source' : source},
                           {'relative': 1,
                            'upgrade' : False,
                            'pretend' : True,
                            'verbose' : False,
                            'linktype': 'soft'})
        webadd.mkfile('test1')
        webadd.mkfile('test4')
        webadd.mkfile('test2')
        webadd.mkfile('test3')
        webadd.mkdir('dir1')
        webadd.mkdir('dir2')

        output = sys.stdout.getvalue().split('\n')

        self.assertEqual(output[0], '*     pretending to add: sym 1 virtual ' +
                                    '"test1"')
        self.assertEqual(output[1], '*     pretending to add: file 1 ' +
                                    'server-owned "test4"')
        self.assertEqual(output[3], '*     pretending to add: sym 1 virtual ' +
                                    '"test2"')
        self.assertEqual(output[4], '^o^ hiding test3')
        self.assertEqual(output[6], '*     pretending to add: dir 1 ' +
                                    'default-owned "dir1"')
        self.assertEqual(output[8], '*     pretending to add: dir 1 ' +
                                    'default-owned "dir2"')

        # Now testing all of them combined:
        webadd.mkdirs('')
        output = sys.stdout.getvalue().split('\n')
        self.assertEqual(output[20], '^o^ hiding /test3')
开发者ID:PPed72,项目名称:webapp-config,代码行数:64,代码来源:external.py


注:本文中的WebappConfig.debug.OUT.color_off方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。