Test fix
diff --git a/xos/tests/api/helpers/before_test.py b/xos/tests/api/helpers/before_test.py
index e53c323..06e27bf 100644
--- a/xos/tests/api/helpers/before_test.py
+++ b/xos/tests/api/helpers/before_test.py
@@ -13,6 +13,7 @@
from services.vtr.models import *
import urllib2
import json
+from django.utils import timezone
django.setup()
@@ -78,6 +79,7 @@
# creating the test subscriber
subscriber = CordSubscriberRoot(name='Test Subscriber 1', id=1)
+ subscriber.created = timezone.now()
subscriber.save()
# vRouter service
@@ -133,7 +135,7 @@
# print 'vcpe_slice created'
# create a lan network
- lan_net = Network()
+ lan_net = Network(id=1)
lan_net.name = 'lan_network'
lan_net.owner = vcpe_slice
lan_net.template = private_template
@@ -181,20 +183,24 @@
def createTruckroll():
setUpTruckroll()
tn = VTRTenant(id=1)
+ tn.created = timezone.now()
tn.save()
def createFlavors():
small = Flavor(id=1)
small.name = "m1.small"
+ small.created = timezone.now()
small.save()
medium = Flavor(id=2)
medium.name = "m1.medium"
+ medium.created = timezone.now()
medium.save()
large = Flavor(id=3)
large.name = "m1.large"
+ large.created = timezone.now()
large.save()
@@ -203,6 +209,7 @@
user = User.objects.get(email="padmin@vicci.org")
sl = Slice(id=1)
+ sl.created = timezone.now()
sl.name = site.login_base + "_testSlice"
sl.site = site
sl.caller = user
@@ -212,6 +219,7 @@
def createDeployment():
deployment = Deployment(id=1)
+ deployment.created = timezone.now()
deployment.name = 'MyTestDeployment'
deployment.save()
return deployment
@@ -220,6 +228,7 @@
def createImage(name):
img = Image(id=1)
img.name = name
+ img.created = timezone.now()
img.disk_format = 'QCOW2'
img.kind = 'vm'
img.save()
@@ -231,11 +240,13 @@
site_deployment = SiteDeployment(id=1)
site_deployment.site = site
+ site_deployment.created = timezone.now()
site_deployment.deployment = deployment
site_deployment.save()
node = Node(id=1)
node.name = 'test-node'
+ node.created = timezone.now()
node.site = site
node.site_deployment = site_deployment
node.save()
@@ -247,7 +258,7 @@
sl = createSlice()
node = createNode(deployment)
img = createImage('test-image')
- print {'image': img.id, 'deployment': deployment.id, 'slice': sl.id}
+ # print {'image': img.id, 'deployment': deployment.id, 'slice': sl.id}
return {'image': img, 'deployment': deployment, 'slice': sl}
@@ -257,6 +268,7 @@
instance = Instance(id=1)
instance.name = 'test-instance'
+ instance.created = timezone.now()
instance.node = Node.objects.all()[0]
instance.image = requirements['image']
instance.slice = requirements['slice']
@@ -264,7 +276,14 @@
instance.caller = user
instance.save()
-setupInstance()
-# createTestSubscriber()
+
+# setupInstance()
+# depl = createDeployment()
+createTestSubscriber()
# createInstance()
-# createNode()
+# createSlice()
+# createNode(depl)
+# createImage('test-image')
+# createFlavors()
+# createTruckroll()
+setUpTruckroll()
diff --git a/xos/tests/api/hooks.py b/xos/tests/api/hooks.py
index 1f4a0ad..2a38d7a 100644
--- a/xos/tests/api/hooks.py
+++ b/xos/tests/api/hooks.py
@@ -13,6 +13,7 @@
from services.vtr.models import *
import urllib2
import json
+from django.utils import timezone
django.setup()
@@ -78,6 +79,7 @@
# creating the test subscriber
subscriber = CordSubscriberRoot(name='Test Subscriber 1', id=1)
+ subscriber.created = timezone.now()
subscriber.save()
# vRouter service
@@ -181,20 +183,24 @@
def createTruckroll():
setUpTruckroll()
tn = VTRTenant(id=1)
+ tn.created = timezone.now()
tn.save()
def createFlavors():
small = Flavor(id=1)
small.name = "m1.small"
+ small.created = timezone.now()
small.save()
medium = Flavor(id=2)
medium.name = "m1.medium"
+ medium.created = timezone.now()
medium.save()
large = Flavor(id=3)
large.name = "m1.large"
+ large.created = timezone.now()
large.save()
@@ -203,6 +209,7 @@
user = User.objects.get(email="padmin@vicci.org")
sl = Slice(id=1)
+ sl.created = timezone.now()
sl.name = site.login_base + "_testSlice"
sl.site = site
sl.caller = user
@@ -212,6 +219,7 @@
def createDeployment():
deployment = Deployment(id=1)
+ deployment.created = timezone.now()
deployment.name = 'MyTestDeployment'
deployment.save()
return deployment
@@ -220,6 +228,7 @@
def createImage(name):
img = Image(id=1)
img.name = name
+ img.created = timezone.now()
img.disk_format = 'QCOW2'
img.kind = 'vm'
img.save()
@@ -231,11 +240,13 @@
site_deployment = SiteDeployment(id=1)
site_deployment.site = site
+ site_deployment.created = timezone.now()
site_deployment.deployment = deployment
site_deployment.save()
node = Node(id=1)
node.name = 'test-node'
+ node.created = timezone.now()
node.site = site
node.site_deployment = site_deployment
node.save()
@@ -257,6 +268,7 @@
instance = Instance(id=1)
instance.name = 'test-instance'
+ instance.created = timezone.now()
instance.node = Node.objects.all()[0]
instance.image = requirements['image']
instance.slice = requirements['slice']