예제 #1
0
파일: upgrade.py 프로젝트: saxix/pyppi
    def handle(self, **options):
        if not settings.STATIC_ROOT.strip():
            raise ValueError("please set a valid value for settings.STATIC_ROOT")
        if not settings.MEDIA_ROOT.strip():
            raise ValueError("please set a valid value for settings.MEDIA_ROOT")
        if not settings.PYPPI_LOG_DIR.strip():
            raise ValueError("please set a valid value for settings.PYPPI_LOG_DIR")
        mktree(settings.STATIC_ROOT)
        mktree(settings.MEDIA_ROOT)
        mktree(settings.PYPPI_LOG_DIR)

        call_command("syncdb", migrate=True, interactive=(not options["noinput"]))
        call_command("loaddata", "pyppi_initial.json", verbosity=0)
        call_command("collectstatic", interactive=False, verbosity=0)
예제 #2
0
파일: base.py 프로젝트: mrc75/pyppi
import os
from django.contrib.auth.models import Group
from django.core.urlresolvers import reverse
from django_dynamic_fixture import G
from pyppi.models import Distribution, Package, Classifier
from pyppi.tests.fixtures import distro_factory, package_factory, release_factory, user_factory
from scripttest import TestFileEnvironment

import pyppi
from pyppi.util import mktree

base = os.path.join(os.path.dirname(pyppi.__file__), os.pardir, '~build', 'test-output')
mktree(os.path.dirname(base))
env = TestFileEnvironment(base, capture_temp=True)


class BaseTestMixin(object):
    def setUp(self):
        super(BaseTestMixin, self).setUp()
        self.env = env
        os.chdir(env.base_path)
        self.sett = self.settings(MEDIA_ROOT=self.env.base_path)
        self.sett.enable()

        f = Distribution._meta.get_field('content')
        f.storage.location, self.storage_location = self.env.base_path, f.storage.location

        self.username = '******'
        self.password = '******'
        self.user = user_factory(self.password, username=self.username)
        self.user2 = user_factory(self.password)