make django tests working again
authorymh <ymh.work@gmail.com>
Tue, 04 Mar 2014 13:28:35 +0100
changeset 590 e103299bccc0
parent 589 a87316d901be
child 591 2274e86e1d72
make django tests working again
buildout.cfg
dev/Vagrantfile
dev/modules/sysconfig/manifests/deploy.pp
dev/modules/sysconfig/manifests/postgresql.pp
dev/modules/sysconfig/templates/settings_local.erb
src/cm/activity.py
src/cm/tests/test_api.py
src/cm/tests/test_notifications.py
src/cm/tests/test_security.py
--- a/buildout.cfg	Sat Mar 01 09:48:26 2014 +0100
+++ b/buildout.cfg	Tue Mar 04 13:28:35 2014 +0100
@@ -14,6 +14,7 @@
 django = 1.3
 utidylib = 0.2
 django-tagging = 0.3.1
+psycopg2 = 2.4.1
 
 [python]
 recipe = zc.recipe.egg
--- a/dev/Vagrantfile	Sat Mar 01 09:48:26 2014 +0100
+++ b/dev/Vagrantfile	Tue Mar 04 13:28:35 2014 +0100
@@ -1,6 +1,7 @@
 # -*- mode: ruby -*-
 # vi: set ft=ruby :
 
+
 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
 VAGRANTFILE_API_VERSION = "2"
 
@@ -23,7 +24,7 @@
 
   # Create a private network, which allows host-only access to the machine
   # using a specific IP.
-  config.vm.network :private_network, ip: "172.16.1.2"
+  config.vm.network :private_network, ip: (ENV['VM_IP'] || "172.16.1.2")
 
   # Create a public network, which generally matched to bridged network.
   # Bridged networks make the machine appear as another physical device on
@@ -40,7 +41,10 @@
   # argument is a set of non-required options.
   config.vm.synced_folder "../", "/srv/comt"
 
-  config.vm.define :coment_dev do |coment_dev|
+  #vmname = "coment_dev_5311da30" #"coment_dev_"+Time.now.getutc.to_f.to_int.to_s(16)
+  vmname = "coment_dev"
+
+  config.vm.define :"#{vmname}" do |coment_dev|
   end
 
   # Provider-specific configuration so you can fine-tune various
@@ -48,7 +52,7 @@
   # Example for VirtualBox:
   #
   config.vm.provider :virtualbox do |vb|
-      vb.name = "coment_dev"
+      vb.name = vmname
   #   # Don't boot with headless mode
   #   vb.gui = true
   #
--- a/dev/modules/sysconfig/manifests/deploy.pp	Sat Mar 01 09:48:26 2014 +0100
+++ b/dev/modules/sysconfig/manifests/deploy.pp	Tue Mar 04 13:28:35 2014 +0100
@@ -45,7 +45,7 @@
     nginx::resource::vhost { $ipaddress_eth1:
         ensure           => present,
         proxy            => 'http://coment_app',
-        proxy_set_header => ['Host \$http_host'],
+        proxy_set_header => ['Host $http_host'],
         vhost_cfg_append => {
             'proxy_redirect' => 'off'
         },
--- a/dev/modules/sysconfig/manifests/postgresql.pp	Sat Mar 01 09:48:26 2014 +0100
+++ b/dev/modules/sysconfig/manifests/postgresql.pp	Tue Mar 04 13:28:35 2014 +0100
@@ -12,9 +12,13 @@
     if $sysconfig::params::db_is_local {
         class { 'postgresql::server': }
 
-        postgresql::server::db { $db_name:
-            user     => $db_user,
-            password => postgresql_password($db_user, $db_pw),
+        postgresql::server::role {"${db_user}_createdb":
+            username      => $db_user,
+            createdb      => true,
+            password_hash => postgresql_password($db_user, $db_pw)
+        }->
+        postgresql::server::database { $db_name:
+            owner    => $db_user,            
             encoding => 'UTF8',
         }
     }
--- a/dev/modules/sysconfig/templates/settings_local.erb	Sat Mar 01 09:48:26 2014 +0100
+++ b/dev/modules/sysconfig/templates/settings_local.erb	Tue Mar 04 13:28:35 2014 +0100
@@ -78,3 +78,10 @@
 # Set to TRUE to use Abiword for convertion form and to legacy formats.
 # Set to False to use LibreOffice for convertion form and to legacy formats.
 USE_ABI = True
+
+# Set to True if you don't want to appear in Sopinspace Piwik statistics
+DISABLE_TRACKING = True
+
+#disable email reporting by piston
+PISTON_EMAIL_ERRORS = False
+
--- a/src/cm/activity.py	Sat Mar 01 09:48:26 2014 +0100
+++ b/src/cm/activity.py	Tue Mar 04 13:28:35 2014 +0100
@@ -31,7 +31,7 @@
         originator_user = request.user
     
     if STORE_ACTIVITY_IP:
-        ip = request.META['REMOTE_ADDR']
+        ip = request.META.get('REMOTE_ADDR', '0.0.0.0')
     else:
         ip = None
     
--- a/src/cm/tests/test_api.py	Sat Mar 01 09:48:26 2014 +0100
+++ b/src/cm/tests/test_api.py	Tue Mar 04 13:28:35 2014 +0100
@@ -22,7 +22,7 @@
         self.user = user
 
 class APITest(TestCase):
-    fixtures = ['roles_generic', 'test_content', ]
+    fixtures = ['initial_data','roles_generic', 'test_content', ]
     
     def test_text_get(self):
         """
--- a/src/cm/tests/test_notifications.py	Sat Mar 01 09:48:26 2014 +0100
+++ b/src/cm/tests/test_notifications.py	Tue Mar 04 13:28:35 2014 +0100
@@ -7,7 +7,7 @@
 from cm.models_utils import *
 
 class NotificationTest(TestCase):
-    fixtures = ['roles_generic','test_content']
+    fixtures = ['initial_data', 'roles_generic','test_content']
     
     def setUp(self):
         pass
--- a/src/cm/tests/test_security.py	Sat Mar 01 09:48:26 2014 +0100
+++ b/src/cm/tests/test_security.py	Tue Mar 04 13:28:35 2014 +0100
@@ -12,7 +12,7 @@
         self.user = user
 
 class SecurityTest(TestCase):
-    fixtures = ['roles_generic','test_content']
+    fixtures = ['initial_data','roles_generic','test_content']
     
     def test_access_rights(self):
         # anon user sees no text