diff --git a/xos/tosca/tests/alltests.py b/xos/tosca/tests/alltests.py
index 341a577..59ad49d 100644
--- a/xos/tosca/tests/alltests.py
+++ b/xos/tosca/tests/alltests.py
@@ -2,9 +2,13 @@
 from porttest import PortTest
 from networktest import NetworkTest
 from servicetest import ServiceTest
+from usertest import UserTest
+from computetest import ComputeTest
 
 if __name__ == "__main__":
     NetworkTest()
     PortTest()
     CoarseTenancyTest()
     ServiceTest()
+    UserTest()
+    ComputeTest()
diff --git a/xos/tosca/tests/basetest.py b/xos/tosca/tests/basetest.py
index 5d873d0..e90aa8e 100644
--- a/xos/tosca/tests/basetest.py
+++ b/xos/tosca/tests/basetest.py
@@ -1,4 +1,6 @@
 import os
+import random
+import string
 import sys
 
 # add the parent parent directory to sys.path
@@ -34,7 +36,7 @@
     def __init__(self):
         self.runtest()
 
-    def make_nodetemplate(self, name, type, props={}, reqs=[], caps={}):
+    def make_nodetemplate(self, name, type, props={}, reqs=[], caps={}, artifacts={}):
         yml = "    %s:\n      type: %s\n"  % (name, type)
         if props:
             yml = yml + "      properties:\n"
@@ -58,8 +60,26 @@
                for (k,v) in capdict.items():
                    yml = yml + "            %s: %s\n" % (k,v)
 
+        if artifacts:
+            yml = yml + "      artifacts:\n"
+            for (k,v) in artifacts.items():
+                yml = yml + "        %s: %s\n" % (k,v)
+
         return yml
 
+    def make_compute(self, slice, name, caps={}, props={}, reqs=[], num_cpus="1", disk_size="10 GB", mem_size="4 MB"):
+        caps.update( {"host": {"num_cpus": num_cpus, "disk_size": disk_size, "mem_size": mem_size},
+                      "os": {"architecture": "x86_64", "type": "linux", "distribution": "rhel", "version": "6.5"}} )
+        reqs.append( (slice, "tosca.relationships.MemberOfSlice") )
+
+        return self.make_nodetemplate(name, "tosca.nodes.Compute",
+                                      caps= caps,
+                                      props = props,
+                                      reqs= reqs)
+
+    def make_random_string(self,desired_len):
+        return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(desired_len))
+
     def assert_noobj(self, cls, name):
         objs = cls.objects.filter(name=name)
         assert(not objs)
diff --git a/xos/tosca/tests/computetest.py b/xos/tosca/tests/computetest.py
new file mode 100644
index 0000000..9eac593
--- /dev/null
+++ b/xos/tosca/tests/computetest.py
@@ -0,0 +1,96 @@
+from basetest import BaseToscaTest
+
+from core.models import Sliver, Slice
+
+class ComputeTest(BaseToscaTest):
+    tests = ["create_compute_m1_tiny",
+             "create_compute_m1_small",
+             "create_compute_m1_large_8192MB",
+             "create_compute_m1_large_8GB",
+             "destroy_compute",
+             "create_compute_scalable",
+             "destroy_compute_scalable",
+                           ]
+
+    def cleanup(self):
+        self.try_to_delete(Sliver, name="test_compute1")
+        self.try_to_delete(Sliver, name="test_compute1-0")
+        self.try_to_delete(Sliver, name="test_compute1-1")
+        self.try_to_delete(Sliver, name="test_compute1-2")
+        self.try_to_delete(Sliver, name="test_compute1-3")
+        self.try_to_delete(Slice, name="testsite_slice1")
+
+    def get_base_templates(self):
+        return self.make_nodetemplate("testsite", "tosca.nodes.Site") + \
+               self.make_nodetemplate("testsite_slice1", "tosca.nodes.Slice", reqs=[("testsite", "tosca.relationships.MemberOfSite")])
+
+    def create_compute_m1_tiny(self):
+        self.assert_noobj(Sliver, "test_compute1")
+        self.execute(self.get_base_templates() +
+                     self.make_compute("testsite_slice1", "test_compute1", disk_size="1 GB", mem_size="500 MB"))
+        sliver = self.assert_obj(Sliver, "test_compute1")
+        assert(sliver.flavor.name == "m1.tiny")
+
+    def create_compute_m1_small(self):
+        self.assert_noobj(Sliver, "test_compute1")
+        self.execute(self.get_base_templates() +
+                     self.make_compute("testsite_slice1", "test_compute1", disk_size="1 GB", mem_size="513 MB"))
+        sliver = self.assert_obj(Sliver, "test_compute1")
+        assert(sliver.flavor.name == "m1.small")
+
+    def create_compute_m1_large_8192MB(self):
+        self.assert_noobj(Sliver, "test_compute1")
+        self.execute(self.get_base_templates() +
+                     self.make_compute("testsite_slice1", "test_compute1", mem_size="8192 MB"))
+        sliver = self.assert_obj(Sliver, "test_compute1")
+        assert(sliver.flavor.name == "m1.large")
+
+    def create_compute_m1_large_8GB(self):
+        self.assert_noobj(Sliver, "test_compute1")
+        self.execute(self.get_base_templates() +
+                     self.make_compute("testsite_slice1", "test_compute1", mem_size="8 GB"))
+        sliver = self.assert_obj(Sliver, "test_compute1")
+        assert(sliver.flavor.name == "m1.large")
+
+    def destroy_compute(self):
+        self.execute(self.get_base_templates() +
+                     self.make_compute("testsite_slice1", "test_compute1"))
+        self.assert_obj(Sliver, "test_compute1")
+        self.destroy(self.get_base_templates() +
+                     self.make_compute("testsite_slice1", "test_compute1"))
+        self.assert_noobj(Sliver, "test_compute1")
+
+    def create_compute_scalable(self):
+        self.assert_noobj(Sliver, "test_compute1-1")
+        self.assert_noobj(Sliver, "test_compute1-2")
+        self.assert_noobj(Sliver, "test_compute1-3")
+        self.execute(self.get_base_templates() +
+                     self.make_compute("testsite_slice1", "test_compute1", mem_size="8 GB",
+                                       caps={"scalable": {"min_instances": 2, "max_instances": 3, "default_instances": 2}}))
+        # there should be two instances
+        sliver0 = self.assert_obj(Sliver, "test_compute1-0")
+        sliver1 = self.assert_obj(Sliver, "test_compute1-1")
+        self.assert_noobj(Sliver, "test_compute1-2")
+
+    def destroy_compute_scalable(self):
+        self.assert_noobj(Sliver, "test_compute1-1")
+        self.assert_noobj(Sliver, "test_compute1-2")
+        self.assert_noobj(Sliver, "test_compute1-3")
+        self.execute(self.get_base_templates() +
+                     self.make_compute("testsite_slice1", "test_compute1", mem_size="8 GB",
+                                       caps={"scalable": {"min_instances": 2, "max_instances": 3, "default_instances": 2}}))
+        # there should be two instances
+        sliver0 = self.assert_obj(Sliver, "test_compute1-0")
+        sliver1 = self.assert_obj(Sliver, "test_compute1-1")
+
+        self.destroy(self.get_base_templates() +
+                     self.make_compute("testsite_slice1", "test_compute1", mem_size="8 GB",
+                                       caps={"scalable": {"min_instances": 2, "max_instances": 3, "default_instances": 2}}))
+
+        self.assert_noobj(Sliver, "test_compute1-0")
+        self.assert_noobj(Sliver, "test_compute1-1")
+
+if __name__ == "__main__":
+    ComputeTest()
+
+
diff --git a/xos/tosca/tests/porttest.py b/xos/tosca/tests/porttest.py
index c7efe33..a0d23e3 100644
--- a/xos/tosca/tests/porttest.py
+++ b/xos/tosca/tests/porttest.py
@@ -43,12 +43,6 @@
     def test_slice2_2(self):
         return Sliver.objects.get(name="test_slice2-2")
 
-    def make_compute(self, slice, name):
-        return self.make_nodetemplate(name, "tosca.nodes.Compute",
-                                      caps={"host": {"num_cpus": "1", "disk_size": "10 GB", "mem_size": "4 MB"},
-                                            "os": {"architecture": "x86_64", "type": "linux", "distribution": "rhel", "version": "6.5"}},
-                                      reqs=[(slice, "tosca.relationships.MemberOfSlice")])
-
     def get_base_templates(self):
         return self.make_nodetemplate("testsite", "tosca.nodes.Site") + \
                self.make_nodetemplate("testsite_slice1", "tosca.nodes.Slice", reqs=[("testsite", "tosca.relationships.MemberOfSite")]) + \
diff --git a/xos/tosca/tests/usertest.py b/xos/tosca/tests/usertest.py
new file mode 100644
index 0000000..f36eb06
--- /dev/null
+++ b/xos/tosca/tests/usertest.py
@@ -0,0 +1,98 @@
+from basetest import BaseToscaTest
+
+from core.models import User
+
+class UserTest(BaseToscaTest):
+    tests = ["create_user_minimal",
+             "create_user_maximal",
+             "create_user_key_artifact",
+             "destroy_user",
+                           ]
+
+    def cleanup(self):
+        self.try_to_delete(User, email="test@user.com")
+
+    def get_base_templates(self):
+        return self.make_nodetemplate("testsite", "tosca.nodes.Site")
+
+    def assert_nouser(self, email):
+        assert(not User.objects.filter(email=email))
+
+    def assert_user(self, email, **kwargs):
+        obj = User.objects.get(email=email)
+        assert(obj)
+        for (k,v) in kwargs.items():
+            if (getattr(obj,k,None) != v):
+                print "Object %s property '%s' is '%s' and should be '%s'" % (obj, k, getattr(obj,k,None), v)
+                assert(False)
+        return obj
+
+    def create_user_minimal(self):
+        self.assert_nouser("test@user.com")
+        self.execute(self.get_base_templates() +
+                     self.make_nodetemplate("test@user.com", "tosca.nodes.User",
+                         props = {"firstname": "test", "lastname": "user", "password": "letmein"},
+                         reqs = [("testsite", "tosca.relationships.MemberOfSite")]))
+        user = self.assert_user("test@user.com",
+                                 firstname="test",
+                                 lastname="user",
+                                 is_active=True,
+                                 is_admin=False)
+
+
+    def create_user_maximal(self):
+        self.assert_nouser("test@user.com")
+        self.execute(self.get_base_templates() +
+                     self.make_nodetemplate("test@user.com", "tosca.nodes.User",
+                         props = {"firstname": "test",
+                                  "lastname": "user",
+                                  "password": "letmein",
+                                  "phone": "123-456-7890",
+                                  "user_url": "http://foo.bar/",
+                                  "public_key": "thisismykey",
+                                  "is_active": False,
+                                  "is_admin": True},
+                         reqs = [("testsite", "tosca.relationships.MemberOfSite")]))
+        user = self.assert_user("test@user.com",
+                                 firstname="test",
+                                 lastname="user",
+                                 phone="123-456-7890",
+                                 user_url="http://foo.bar/",
+                                 public_key="thisismykey",
+                                 # is_active=False, XXX investigate -- this is failing
+                                 is_admin=True)
+
+    def create_user_key_artifact(self):
+        self.assert_nouser("test@user.com")
+        pubkey = self.make_random_string(400)
+        file("/tmp/pubkey", "w").write(pubkey)
+        self.execute(self.get_base_templates() +
+                     self.make_nodetemplate("test@user.com", "tosca.nodes.User",
+                         props = {"firstname": "test", "lastname": "user", "password": "letmein", "public_key": "{ get_artifact: [ SELF, pubkey, LOCAL_FILE] }" },
+                         artifacts = {"pubkey": "/tmp/pubkey"},
+                         reqs = [("testsite", "tosca.relationships.MemberOfSite")]))
+        user = self.assert_user("test@user.com",
+                                 firstname="test",
+                                 lastname="user",
+                                 is_active=True,
+                                 is_admin=False,
+                                 public_key=pubkey)
+
+    def destroy_user(self):
+        self.assert_nouser("test@user.com")
+        self.execute(self.get_base_templates() +
+                     self.make_nodetemplate("test@user.com", "tosca.nodes.User",
+                         props = {"firstname": "test", "lastname": "user", "password": "letmein"},
+                         reqs = [("testsite", "tosca.relationships.MemberOfSite")]))
+        user = self.assert_user("test@user.com")
+        self.destroy(self.get_base_templates() +
+                     self.make_nodetemplate("test@user.com", "tosca.nodes.User",
+                         props = {"firstname": "test", "lastname": "user", "password": "letmein"},
+                         reqs = [("testsite", "tosca.relationships.MemberOfSite")]))
+        self.assert_nouser("test@user.com")
+
+
+if __name__ == "__main__":
+    UserTest()
+
+
