Beispiel #1
0
    def test_get_repo_units(self):
        # Setup
        self.populate()
        # Test
        conduit = ProfilerConduit()
        units1 = conduit.get_repo_units(self.REPO_ID, content_type_id=self.TYPE_1_DEF.id,
                                        additional_unit_fields=[])
        units2 = conduit.get_repo_units(self.REPO_ID, content_type_id=self.TYPE_2_DEF.id,
                                        additional_unit_fields=[])

        # Verify that all the units in the repo with given type are returned along with unit_key
        self.assertEquals(len(units1), 9)
        for u in units1:
            self.assertTrue('key-1' in u.unit_key)
            self.assertFalse('key-2' in u.unit_key)
        self.assertEquals(len(units2), 9)
        for u in units2:
            self.assertTrue('key-2' in u.unit_key)
            self.assertFalse('key-1' in u.unit_key)
Beispiel #2
0
    def test_get_repo_units(self):
        # Setup
        self.populate()
        # Test
        conduit = ProfilerConduit()
        units1 = conduit.get_repo_units(self.REPO_ID,
                                        content_type_id=self.TYPE_1_DEF.id,
                                        additional_unit_fields=[])
        units2 = conduit.get_repo_units(self.REPO_ID,
                                        content_type_id=self.TYPE_2_DEF.id,
                                        additional_unit_fields=[])

        # Verify that all the units in the repo with given type are returned along with unit_key
        self.assertEquals(len(units1), 9)
        for u in units1:
            self.assertTrue('key-1' in u.unit_key)
            self.assertFalse('key-2' in u.unit_key)
        self.assertEquals(len(units2), 9)
        for u in units2:
            self.assertTrue('key-2' in u.unit_key)
            self.assertFalse('key-1' in u.unit_key)
Beispiel #3
0
    def test_get_repo_units_additional_field(self):
        # Setup
        self.populate(additional_key='extra_field')
        # Test
        conduit = ProfilerConduit()
        units = conduit.get_repo_units(self.REPO_ID, content_type_id=self.TYPE_1_DEF.id, 
                                       additional_unit_fields=['extra_field'])

        # Verify that all the units in the repo with given type are returned along with unit_key and extra field
        self.assertEquals(len(units), 9)
        for u in units:
            self.assertTrue('key-1' in u.unit_key)
            self.assertTrue('extra_field' in u.metadata)
Beispiel #4
0
    def test_get_repo_units_additional_field(self):
        # Setup
        self.populate(additional_key='extra_field')
        # Test
        conduit = ProfilerConduit()
        units = conduit.get_repo_units(self.REPO_ID,
                                       content_type_id=self.TYPE_1_DEF.id,
                                       additional_unit_fields=['extra_field'])

        # Verify that all the units in the repo with given type are returned along with unit_key and extra field
        self.assertEquals(len(units), 9)
        for u in units:
            self.assertTrue('key-1' in u.unit_key)
            self.assertTrue('extra_field' in u.metadata)