Ejemplo n.º 1
0
 def test_list_unused(self):
     source = WebappSource(root='/'.join((HERE, 'testfiles',
                                          'share-webapps')))
     db = WebappDB(root='/'.join((HERE, 'testfiles', 'webapps')))
     source.listunused(db)
     output = sys.stdout.getvalue().split('\n')
     self.assertEqual(output[2], 'share-webapps/uninstalled-6.6.6')
Ejemplo n.º 2
0
 def test_pkg_avail(self):
     source = WebappSource(root='/'.join(
         (HERE, 'testfiles', 'share-webapps')),
                           category='',
                           package='nihil',
                           version='3.0.5',
                           pm='portage')
     self.assertEqual(source.packageavail(), 0)
Ejemplo n.º 3
0
 def test_get_src_files(self):
     source = WebappSource(root='/'.join(
         (HERE, 'testfiles', 'share-webapps')),
                           category='',
                           package='horde',
                           version='3.0.5')
     files = source.get_source_files('htdocs')
     self.assertEqual(files, ['test1', 'test2'])
Ejemplo n.º 4
0
 def test_src_exists(self):
     source = WebappSource(root='/'.join(
         (HERE, 'testfiles', 'share-webapps')),
                           category='',
                           package='horde',
                           version='3.0.5')
     self.assertTrue(source.source_exists('htdocs'))
     self.assertFalse(source.source_exists('foobar'))
Ejemplo n.º 5
0
 def test_pkg_avail(self):
     source = WebappSource(root = '/'.join((HERE, 'testfiles',
                                            'share-webapps')),
                           category = '',
                           package = 'nihil',
                           version = '3.0.5',
                           pm = 'portage')
     self.assertEqual(source.packageavail(), 0)
Ejemplo n.º 6
0
 def test_get_src_files(self):
     source = WebappSource(root = '/'.join((HERE, 'testfiles',
                                            'share-webapps')),
                           category = '',
                           package = 'horde',
                           version = '3.0.5')
     files = source.get_source_files('htdocs')
     self.assertEqual(files, ['test1', 'test2'])
Ejemplo n.º 7
0
 def test_src_exists(self):
     source = WebappSource(root = '/'.join((HERE, 'testfiles',
                                            'share-webapps')),
                           category = '',
                           package = 'horde',
                           version = '3.0.5')
     self.assertTrue(source.source_exists('htdocs'))
     self.assertFalse(source.source_exists('foobar'))
Ejemplo n.º 8
0
 def test_list_unused(self):
     source = WebappSource(root = '/'.join((HERE,
                                           'testfiles',
                                           'share-webapps')))
     db = WebappDB(root = '/'.join((HERE, 'testfiles', 'webapps')))
     source.listunused(db)
     output = sys.stdout.getvalue().split('\n')
     self.assertEqual(output[2], 'share-webapps/uninstalled-6.6.6')
Ejemplo n.º 9
0
 def test_get_src_dirs(self):
     source = WebappSource(root='/'.join(
         (HERE, 'testfiles', 'share-webapps')),
                           category='',
                           package='horde',
                           version='3.0.5')
     dirs = source.get_source_directories('htdocs')
     dirs = [i for i in dirs if i != '.svn']
     self.assertEqual(dirs, ['dir1', 'dir2'])
Ejemplo n.º 10
0
 def test_get_src_dirs(self):
     source = WebappSource(root = '/'.join((HERE, 'testfiles',
                                            'share-webapps')),
                           category = '',
                           package = 'horde',
                           version = '3.0.5')
     dirs = source.get_source_directories('htdocs')
     dirs = [i for i in dirs if i != '.svn']
     self.assertEqual(dirs, ['dir1', 'dir2'])
Ejemplo n.º 11
0
    def test_read(self):
        source = WebappSource(root='/'.join(
            (HERE, 'testfiles', 'share-webapps')),
                              category='',
                              package='horde',
                              version='3.0.5')

        source.read()
        self.assertEqual(source.filetype('test1'), 'config-owned')
        self.assertEqual(source.filetype('test2'), 'server-owned')
Ejemplo n.º 12
0
        def test_read(self):
            source = WebappSource(root = '/'.join((HERE,
                                                   'testfiles',
                                                   'share-webapps')),
                                  category = '',
                                  package = 'horde',
                                  version = '3.0.5')

            source.read()
            self.assertEqual(source.filetype('test1'), 'config-owned')
            self.assertEqual(source.filetype('test2'), 'server-owned')
Ejemplo n.º 13
0
    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')
Ejemplo n.º 14
0
    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')