Ejemplo n.º 1
0
    def test_ensure_fully_via_keyword(self):
        # arg list inits
        raise SkipTest()
        testobj = BlockUsageLocator(version_guid='versionid')
        self.assertRaises(InsufficientSpecificationError,
                          BlockUsageLocator.ensure_fully_specified, testobj)

        testurn = 'crx/courseid@revision/blockid'
        testobj = BlockUsageLocator(version_guid='versionid',
                                    usage_id='myblock')
        self.assertIsInstance(
            BlockUsageLocator.ensure_fully_specified(testurn),
            BlockUsageLocator, testurn)

        testobj = BlockUsageLocator(course_id='courseid')
        self.assertRaises(InsufficientSpecificationError,
                          BlockUsageLocator.ensure_fully_specified, testobj)

        testobj = BlockUsageLocator(course_id='courseid', revision='rev')
        self.assertRaises(InsufficientSpecificationError,
                          BlockUsageLocator.ensure_fully_specified, testobj)

        testobj = BlockUsageLocator(course_id='courseid',
                                    revision='rev',
                                    usage_id='this_block')
        self.assertIsInstance(
            BlockUsageLocator.ensure_fully_specified(testurn),
            BlockUsageLocator, testurn)
Ejemplo n.º 2
0
    def test_ensure_fully_specd(self):
        '''
        Test constructor and property accessors.
        '''
        raise SkipTest()
        self.assertRaises(InsufficientSpecificationError,
                          BlockUsageLocator.ensure_fully_specified,
                          BlockUsageLocator())

        # url inits
        testurn = 'edx://org/course/category/name'
        self.assertRaises(InvalidLocationError,
                          BlockUsageLocator.ensure_fully_specified, testurn)
        testurn = 'unknown/versionid/blockid'
        self.assertRaises(InvalidLocationError,
                          BlockUsageLocator.ensure_fully_specified, testurn)

        testurn = 'cvx/versionid'
        self.assertRaises(InsufficientSpecificationError,
                          BlockUsageLocator.ensure_fully_specified, testurn)

        testurn = 'cvx/versionid/'
        self.assertRaises(InsufficientSpecificationError,
                          BlockUsageLocator.ensure_fully_specified, testurn)

        testurn = 'cvx/versionid/blockid'
        self.assertIsInstance(
            BlockUsageLocator.ensure_fully_specified(testurn),
            BlockUsageLocator, testurn)

        testurn = 'cvx/versionid/blockid/extraneousstuff?including=args'
        self.assertIsInstance(
            BlockUsageLocator.ensure_fully_specified(testurn),
            BlockUsageLocator, testurn)

        testurn = 'cvx://versionid/blockid'
        self.assertIsInstance(
            BlockUsageLocator.ensure_fully_specified(testurn),
            BlockUsageLocator, testurn)

        testurn = 'crx/courseid/blockid'
        self.assertIsInstance(
            BlockUsageLocator.ensure_fully_specified(testurn),
            BlockUsageLocator, testurn)

        testurn = 'crx/courseid@revision/blockid'
        self.assertIsInstance(
            BlockUsageLocator.ensure_fully_specified(testurn),
            BlockUsageLocator, testurn)
Ejemplo n.º 3
0
    def test_ensure_fully_specd(self):
        '''
        Test constructor and property accessors.
        '''
        raise SkipTest()
        self.assertRaises(InsufficientSpecificationError,
                          BlockUsageLocator.ensure_fully_specified, BlockUsageLocator())

        # url inits
        testurn = 'edx://org/course/category/name'
        self.assertRaises(InvalidLocationError,
                          BlockUsageLocator.ensure_fully_specified, testurn)
        testurn = 'unknown/versionid/blockid'
        self.assertRaises(InvalidLocationError,
                          BlockUsageLocator.ensure_fully_specified, testurn)

        testurn = 'cvx/versionid'
        self.assertRaises(InsufficientSpecificationError,
                          BlockUsageLocator.ensure_fully_specified, testurn)

        testurn = 'cvx/versionid/'
        self.assertRaises(InsufficientSpecificationError,
                          BlockUsageLocator.ensure_fully_specified, testurn)

        testurn = 'cvx/versionid/blockid'
        self.assertIsInstance(BlockUsageLocator.ensure_fully_specified(testurn),
                              BlockUsageLocator, testurn)

        testurn = 'cvx/versionid/blockid/extraneousstuff?including=args'
        self.assertIsInstance(BlockUsageLocator.ensure_fully_specified(testurn),
                              BlockUsageLocator, testurn)

        testurn = 'cvx://versionid/blockid'
        self.assertIsInstance(BlockUsageLocator.ensure_fully_specified(testurn),
                              BlockUsageLocator, testurn)

        testurn = 'crx/courseid/blockid'
        self.assertIsInstance(BlockUsageLocator.ensure_fully_specified(testurn),
                              BlockUsageLocator, testurn)

        testurn = 'crx/courseid@revision/blockid'
        self.assertIsInstance(BlockUsageLocator.ensure_fully_specified(testurn),
                              BlockUsageLocator, testurn)
Ejemplo n.º 4
0
    def test_ensure_fully_via_keyword(self):
        # arg list inits
        raise SkipTest()
        testobj = BlockUsageLocator(version_guid='versionid')
        self.assertRaises(InsufficientSpecificationError,
                          BlockUsageLocator.ensure_fully_specified, testobj)

        testurn = 'crx/courseid@revision/blockid'
        testobj = BlockUsageLocator(version_guid='versionid', usage_id='myblock')
        self.assertIsInstance(BlockUsageLocator.ensure_fully_specified(testurn),
                              BlockUsageLocator, testurn)

        testobj = BlockUsageLocator(course_id='courseid')
        self.assertRaises(InsufficientSpecificationError,
                          BlockUsageLocator.ensure_fully_specified, testobj)

        testobj = BlockUsageLocator(course_id='courseid', revision='rev')
        self.assertRaises(InsufficientSpecificationError,
                          BlockUsageLocator.ensure_fully_specified, testobj)

        testobj = BlockUsageLocator(course_id='courseid', revision='rev',
                                    usage_id='this_block')
        self.assertIsInstance(BlockUsageLocator.ensure_fully_specified(testurn),
                              BlockUsageLocator, testurn)