def test_Project__create_subcategorie():
    x = Configuration("%s/in/configuration.xml" % FULLPATH)
    y = Project('anatomist', x)
    for y.type in y.types:
        y._Project__create_subcategorie("%s/out" % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.app.anatomist.run' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.app.anatomist.run/meta' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.app.anatomist.usrdoc' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.app.anatomist.usrdoc/meta' %
                         FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.dev.anatomist.dev' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.dev.anatomist.dev/meta' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.dev.anatomist.devdoc' % FULLPATH)
    assert os.path.isdir('%s/out/brainvisa.dev.anatomist.devdoc/meta' %
                         FULLPATH)
    assert os.path.isfile(
        '%s/out/brainvisa.app.anatomist.run/meta/package.xml' % FULLPATH)
    assert os.path.isfile(
        '%s/out/brainvisa.app.anatomist.usrdoc/meta/package.xml' % FULLPATH)
    assert os.path.isfile(
        '%s/out/brainvisa.dev.anatomist.dev/meta/package.xml' % FULLPATH)
    assert os.path.isfile(
        '%s/out/brainvisa.dev.anatomist.devdoc/meta/package.xml' % FULLPATH)

    filename = '%s/out/brainvisa.app.anatomist.run/meta/package.xml' % FULLPATH
    assert '<DisplayName>%s</DisplayName>' % x.category_by_id(
        'run').Name in open(filename, 'r').read()
    assert '<Name>brainvisa.app.anatomist.run</Name>' in open(filename,
                                                              'r').read()
    assert '<Version>4.5.0</Version>' in open(filename, 'r').read()
    assert '<ReleaseDate>%s</ReleaseDate>' % CURRENTDATE in open(
        filename, 'r').read()
def test_Repository__create_packages_dev():
    x = Configuration("%s/in/configuration.xml" % FULLPATH)
    folder = "%s/out/repository_pack_dev" % FULLPATH
    os.mkdir(folder)
    os.mkdir("%s/packages" % folder)
    y = Repository(folder, x, None)
    y._Repository__create_packages_dev()
    filename = '%s/packages/brainvisa.dev/meta/package.xml' % folder
    assert os.path.isdir('%s/packages/brainvisa.dev' % folder)
    assert os.path.isdir('%s/packages/brainvisa.dev/meta' % folder)
    assert os.path.isfile(filename)
    assert '<DisplayName>%s</DisplayName>' % x.category_by_id(
        'DEV').Name in open(filename, 'r').read()
    assert '<ReleaseDate>%s</ReleaseDate>' % CURRENTDATE in open(
        filename, 'r').read()
    assert '<Name>brainvisa.dev</Name>' in open(filename, 'r').read()