def requirements_update_test(self):
        block_name = BlockName("user/block")
        text = "[requirements]\n # My comment\n"
        config = BiiConfig(text)
        self.assertEqual(config.dumps(), None)

        version = BlockVersion(block_name.default_block(), 0)
        config.requirements = BlockVersionTable([version])
        dumped = config.dumps()
        self.assertEqual(dumped, "[requirements]\n\t user/block: 0\n\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config2 = BiiConfig(dumped)
        self.assertEqual(config2.requirements, config.requirements)

        block_name2 = BlockName("auser2/block2")
        version2 = BlockVersion(block_name2.default_block(), 2)
        config.requirements = BlockVersionTable([version, version2])
        dumped = config.dumps()
        self.assertEqual(dumped, "[requirements]\n"
                                 "\t auser2/block2: 2\n\t user/block: 0\n\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config3 = BiiConfig(dumped)
        self.assertEqual(config3.requirements, config.requirements)
Esempio n. 2
0
    def requirements_update_test(self):
        block_name = BlockName("user/block")
        text = "[requirements]\n # My comment\n"
        config = BiiConfig(text)
        self.assertEqual(config.dumps(), None)

        version = BlockVersion(block_name.default_block(), 0)
        config.requirements = BlockVersionTable([version])
        dumped = config.dumps()
        self.assertEqual(dumped, "[requirements]\n\t user/block: 0\n\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config2 = BiiConfig(dumped)
        self.assertEqual(config2.requirements, config.requirements)

        block_name2 = BlockName("auser2/block2")
        version2 = BlockVersion(block_name2.default_block(), 2)
        config.requirements = BlockVersionTable([version, version2])
        dumped = config.dumps()
        self.assertEqual(
            dumped, "[requirements]\n"
            "\t auser2/block2: 2\n\t user/block: 0\n\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config3 = BiiConfig(dumped)
        self.assertEqual(config3.requirements, config.requirements)
    def parent_test(self):
        block_name = BlockName("user/block")
        version = BlockVersion(block_name.default_block(), 0)
        for text in (parent1, parent2):
            config = BiiConfig(text)
            self.assertEqual(config.parent, version)
            self.assertEqual(None, config.dumps())

        config = BiiConfig(parent3)
        self.assertEqual(config.parent, None)
        self.assertEqual(None, config.dumps())

        version = BlockVersion.loads("user/block(track): -1")
        config = BiiConfig(parent4)
        self.assertEqual(config.parent, version)
        self.assertEqual(None, config.dumps())
 def empty_test(self):
     config = BiiConfig("")
     self.assertEqual(config.parent, None)
     self.assertEqual(config.requirements, BlockVersionTable())
     self.assertEqual(config.mains, [])
     self.assertEqual(config.dependencies, [])
     self.assertEqual(None, config.dumps())
Esempio n. 5
0
    def parent_test(self):
        block_name = BlockName("user/block")
        version = BlockVersion(block_name.default_block(), 0)
        for text in (parent1, parent2):
            config = BiiConfig(text)
            self.assertEqual(config.parent, version)
            self.assertEqual(None, config.dumps())

        config = BiiConfig(parent3)
        self.assertEqual(config.parent, None)
        self.assertEqual(None, config.dumps())

        version = BlockVersion.loads("user/block(track): -1")
        config = BiiConfig(parent4)
        self.assertEqual(config.parent, version)
        self.assertEqual(None, config.dumps())
Esempio n. 6
0
 def empty_test(self):
     config = BiiConfig("")
     self.assertEqual(config.parent, None)
     self.assertEqual(config.requirements, BlockVersionTable())
     self.assertEqual(config.mains, [])
     self.assertEqual(config.dependencies, [])
     self.assertEqual(None, config.dumps())
    def parent_update_test(self):
        block_name = BlockName("user/block")
        text = "[parent]\n # My comment\n"
        config = BiiConfig(text)
        self.assertEqual(config.dumps(), None)

        version = BlockVersion(block_name.default_block(), 0)
        config.parent = version
        dumped = config.dumps()
        self.assertEqual(dumped, "[parent]\n\tuser/block: 0\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config2 = BiiConfig(dumped)
        self.assertEqual(config2.parent, config.parent)

        version2 = BlockVersion.loads("user/block(track): 2")
        config.parent = version2
        dumped = config.dumps()
        self.assertEqual(dumped, "[parent]\n\tuser/block(track): 2\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config3 = BiiConfig(dumped)
        self.assertEqual(config3.parent, config.parent)
Esempio n. 8
0
    def parent_update_test(self):
        block_name = BlockName("user/block")
        text = "[parent]\n # My comment\n"
        config = BiiConfig(text)
        self.assertEqual(config.dumps(), None)

        version = BlockVersion(block_name.default_block(), 0)
        config.parent = version
        dumped = config.dumps()
        self.assertEqual(dumped, "[parent]\n\tuser/block: 0\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config2 = BiiConfig(dumped)
        self.assertEqual(config2.parent, config.parent)

        version2 = BlockVersion.loads("user/block(track): 2")
        config.parent = version2
        dumped = config.dumps()
        self.assertEqual(dumped, "[parent]\n\tuser/block(track): 2\n")
        # Dump again, no changes
        self.assertEqual(config.dumps(), None)
        config3 = BiiConfig(dumped)
        self.assertEqual(config3.parent, config.parent)