from . import uuid


def task_crud(self, shotgun, trigger_poll=lambda: None):

    name = uuid(8)
    a = shotgun.create('Task', {'content': name})
    trigger_poll()
    b = self.cached.find_one('Task', [('id', 'is', a['id'])], ['content'])
    self.assertSameEntity(a, b)

    name += '-2'
    shotgun.update('Task', a['id'], {'content': name})
    trigger_poll()
    c = self.cached.find_one('Task', [('id', 'is', a['id'])], ['content'])
    self.assertEqual(c['content'], name)

    shotgun.delete('Task', a['id'])
    trigger_poll()
    d = self.cached.find_one('Task', [('id', 'is', a['id'])], ['content'])
    self.assertIs(d, None)

@@ -72,24 +72,29 @@
 None):%0A%0A    
+shot_
 name = uuid(
@@ -100,17 +100,95 @@
 (8)%0A    
-a
+shot = shotgun.create('Shot', %7B'code': shot_name%7D)%0A%0A    name = uuid(8)%0A    task
  = shotg
@@ -213,32 +213,48 @@
 %7B'content': name
+, 'entity': shot
 %7D)%0A    trigger_p
@@ -263,13 +263,14 @@
 l()%0A
+%0A
     
-b
+x
  = s
@@ -303,33 +303,36 @@
 , %5B('id', 'is', 
-a
+task
 %5B'id'%5D)%5D, %5B'cont
@@ -368,15 +368,351 @@
 ity(
-a, b
+task, x
 )%0A%0A
+    # entity field%0A    x = self.cached.find_one('Task', %5B('id', 'is', task%5B'id'%5D)%5D, %5B'entity'%5D)%0A    self.assertSameEntity(shot, x%5B'entity'%5D)%0A%0A    # return through entity field%0A    x = self.cached.find_one('Task', %5B('id', 'is', task%5B'id'%5D)%5D, %5B'entity.Shot.code'%5D)%0A    self.assertEqual(shot_name, x%5B'entity.Shot.code'%5D)%0A%0A    # Updates%0A
     
@@ -747,25 +747,28 @@
 ate('Task', 
-a
+task
 %5B'id'%5D, %7B'co
@@ -805,17 +805,17 @@
 l()%0A    
-c
+x
  = self.
@@ -844,33 +844,36 @@
 , %5B('id', 'is', 
-a
+task
 %5B'id'%5D)%5D, %5B'cont
@@ -900,17 +900,17 @@
 rtEqual(
-c
+x
 %5B'conten
@@ -921,16 +921,29 @@
  name)%0A%0A
+    # Delete%0A
     shot
@@ -961,17 +961,20 @@
 'Task', 
-a
+task
 %5B'id'%5D)%0A
@@ -996,17 +996,17 @@
 l()%0A    
-d
+x
  = self.
@@ -1043,17 +1043,20 @@
 , 'is', 
-a
+task
 %5B'id'%5D)%5D
@@ -1092,13 +1092,13 @@
 tIs(
-d
+x
 , None)%0A
@@ -1097,8 +1097,140 @@
 , None)%0A
+    x = self.cached.find_one('Task', %5B('id', 'is', task%5B'id'%5D)%5D, %5B'content'%5D, retired_only=True)%0A    self.assertSameEntity(task, x)%0A

Add entity link to basic crud tests