Exemplo n.º 1
0
def populate_db(request, news_count, products_count, categories_count):
    if is_production_server():
        return Http404()

    call_command('populatedb',
                 news_count=news_count, products_count=products_count, categories_count=categories_count)
    return HttpResponse('<div id="ok">Successfully created {} news</div>'.format(news_count))
Exemplo n.º 2
0
 def setUpClass(cls):
     if is_production_server():
         cls.server_url = 'http://not_a_valid_domain_name/at_all'
     elif is_staging_server():
         cls.server_url = 'http://' + settings.SERVER_URL
     else:
         super().setUpClass()
         cls.server_url = cls.live_server_url
Exemplo n.º 3
0
    def setUp(self):
        if is_production_server():
            self.fail("Tests should never be launched on production server")

        self.browser = webdriver.Firefox()
        self.browser.implicitly_wait(0)
        self.faker = FakerFactory.create('fr_FR')
        self.faker.seed(None)

        # @todo remove this when it is not needed anymore (should be done by the migration #3 and some others
        from django.contrib.auth.models import Group
        if not Group.objects.all():
            insert_all_permissions()
        # End of the removable stuff

        self.config = SiteConfiguration.objects.get()