def test_no_children_add(self):
		"""
			ChildContainer: NO CHILDREN ADD 
			-------------------------------
			Should throw an exception upon trying to get children
		"""
		schema = {'contains':[]}
		mongo_doc = {'children':{}}
		c = ChildContainer('parent_1', mongo_doc)
		c.add(Frame, 'child_1')
Exemple #2
0
    def test_no_children_add(self):
        """
			ChildContainer: NO CHILDREN ADD 
			-------------------------------
			Should throw an exception upon trying to get children
		"""
        schema = {'contains': []}
        mongo_doc = {'children': {}}
        c = ChildContainer('parent_1', mongo_doc)
        c.add(Frame, 'child_1')
Exemple #3
0
    def test_access_bad_childtype(self):
        """
			ChildContainer: ACCESS WITH BAD CHILDTYPE 
			-----------------------------------------
			Tries to get_child with a bad childtype
		"""
        schema = {'contains': [Frame]}
        mongo_doc = {'children': {}}
        mongo_doc['children'] = {'Frame': {'frame_1': 'parent_id/frame_1'}}
        c = ChildContainer('parent_1', schema, mongo_doc)
        c.get(Video, 'frame_1')
	def test_access_bad_childtype(self):
		"""
			ChildContainer: ACCESS WITH BAD CHILDTYPE 
			-----------------------------------------
			Tries to get_child with a bad childtype
		"""
		schema = {'contains':[Frame]}
		mongo_doc = {'children':{}}
		mongo_doc['children'] = {'Frame':{'frame_1':'parent_id/frame_1'}}
		c = ChildContainer('parent_1', schema, mongo_doc)
		c.get(Video, 'frame_1')
	def test_single_childtype_delete(self):
		"""
			ChildContainer: SINGLE CHILDTYPE DELETE 
			----------------------------------------
			Constructs a ChildContainer with a single childtype, tests 
			delete method
		"""
		schema = {'contains':[Frame]}
		mongo_doc = {'children':{}}
		mongo_doc['children'] = {'Frame':{'frame_1':'parent_id/frame_1'}}
		c = ChildContainer('parent_id', schema, mongo_doc)

		c.add(Frame, 'frame_2')
		c.delete('frame_2')
		self.get('frame_2')
Exemple #6
0
    def test_single_childtype_get(self):
        """
			ChildContainer: SINGLE CHILDTYPE GET
			------------------------------------
			Constructs a ChildContainer a single childtype, tests
			get method
		"""
        schema = {'contains': [Frame]}
        mongo_doc = {'children': {}}
        mongo_doc['children'] = {'Frame': {'frame_1': 'parent_id/frame_1'}}

        c = ChildContainer('parent_id', schema, mongo_doc)

        self.assertEqual(c.get('frame_1')[0], Frame)
        self.assertEqual(c.get('frame_1')[1], 'parent_id/frame_1')
        self.assertEqual(c.get(Frame, 'frame_1')[1], 'parent_id/frame_1')
	def test_single_childtype_get(self):
		"""
			ChildContainer: SINGLE CHILDTYPE GET
			------------------------------------
			Constructs a ChildContainer a single childtype, tests
			get method
		"""
		schema = {'contains':[Frame]}
		mongo_doc = {'children':{}}
		mongo_doc['children'] = {'Frame':{'frame_1':'parent_id/frame_1'}}

		c = ChildContainer('parent_id', schema, mongo_doc)

		self.assertEqual(c.get('frame_1')[0], Frame)
		self.assertEqual(c.get('frame_1')[1], 'parent_id/frame_1')		
		self.assertEqual(c.get(Frame, 'frame_1')[1], 'parent_id/frame_1')
Exemple #8
0
    def test_multiple_childtype_get(self):
        """
			ChildContainer: MULTIPLE CHILDTYPE GET
			---------------------------------------
			Constructs a ChildContainer w/ multiple childtypes, tests
			get method
		"""
        schema = {'contains': [Video, Frame]}
        mongo_doc = {'children': {}}
        mongo_doc['children']['Frame'] = {'frame_1': 'parent_id/frame_1'}
        mongo_doc['children']['Video'] = {'video_1': 'parent_id/video_1'}

        c = ChildContainer('parent_id', schema, mongo_doc)

        self.assertEqual(c.get(Frame, 'frame_1')[0], Frame)
        self.assertEqual(c.get(Frame, 'frame_1')[1], 'parent_id/frame_1')
        self.assertEqual(c.get(Video, 'video_1')[0], Video)
        self.assertEqual(c.get(Video, 'video_1')[1], 'parent_id/video_1')
	def test_multiple_childtype_get(self):
		"""
			ChildContainer: MULTIPLE CHILDTYPE GET
			---------------------------------------
			Constructs a ChildContainer w/ multiple childtypes, tests
			get method
		"""
		schema = {'contains':[Video, Frame]}
		mongo_doc = {'children':{}}
		mongo_doc['children']['Frame'] = {'frame_1':'parent_id/frame_1'}
		mongo_doc['children']['Video'] = {'video_1':'parent_id/video_1'}

		c = ChildContainer('parent_id', schema, mongo_doc)

		self.assertEqual(c.get(Frame, 'frame_1')[0], Frame)
		self.assertEqual(c.get(Frame, 'frame_1')[1], 'parent_id/frame_1')		
		self.assertEqual(c.get(Video, 'video_1')[0], Video)
		self.assertEqual(c.get(Video, 'video_1')[1], 'parent_id/video_1')		
	def test_multiple_childtype_add(self):
		"""
			ChildContainer: MULTIPLE_CHILDTYPE_ADD 
			--------------------------------------
			Constructs a ChildContainer with multiple childtypes, tests
			add method
		"""
		schema = {'contains':[Frame, Video]}
		mongo_doc = {'children':{}}
		mongo_doc['children']['Frame'] = {'frame_1':'parent_id/frame_1'}
		mongo_doc['children']['Video'] = {'video_1':'parent_id/video_1'}
		c = ChildContainer('parent_id', schema, mongo_doc)

		c.add(Frame, 'frame_2')
		c.add(Video, 'video_2')

		self.assertEqual(c.get(Frame, 'frame_2')[0], Frame)
		self.assertEqual(c.get(Frame, 'frame_2')[1], 'parent_id/frame_2')		
		self.assertEqual(c.get(Video, 'video_2')[0], Video)
		self.assertEqual(c.get(Video, 'video_2')[1], 'parent_id/video_2')
Exemple #11
0
    def test_single_childtype_delete(self):
        """
			ChildContainer: SINGLE CHILDTYPE DELETE 
			----------------------------------------
			Constructs a ChildContainer with a single childtype, tests 
			delete method
		"""
        schema = {'contains': [Frame]}
        mongo_doc = {'children': {}}
        mongo_doc['children'] = {'Frame': {'frame_1': 'parent_id/frame_1'}}
        c = ChildContainer('parent_id', schema, mongo_doc)

        c.add(Frame, 'frame_2')
        c.delete('frame_2')
        self.get('frame_2')
Exemple #12
0
    def test_multiple_childtype_add(self):
        """
			ChildContainer: MULTIPLE_CHILDTYPE_ADD 
			--------------------------------------
			Constructs a ChildContainer with multiple childtypes, tests
			add method
		"""
        schema = {'contains': [Frame, Video]}
        mongo_doc = {'children': {}}
        mongo_doc['children']['Frame'] = {'frame_1': 'parent_id/frame_1'}
        mongo_doc['children']['Video'] = {'video_1': 'parent_id/video_1'}
        c = ChildContainer('parent_id', schema, mongo_doc)

        c.add(Frame, 'frame_2')
        c.add(Video, 'video_2')

        self.assertEqual(c.get(Frame, 'frame_2')[0], Frame)
        self.assertEqual(c.get(Frame, 'frame_2')[1], 'parent_id/frame_2')
        self.assertEqual(c.get(Video, 'video_2')[0], Video)
        self.assertEqual(c.get(Video, 'video_2')[1], 'parent_id/video_2')