def test_clear_config(self):
     ch = ConfigHolder(MACROS, MockVersionControl(), file_manager=MockConfigurationFileManager(), test_config=None)
     add_block(ch, "TESTBLOCK1", "PV1", "GROUP1", True)
     add_block(ch, "TESTBLOCK2", "PV2", "GROUP2", True)
     add_block(ch, "TESTBLOCK3", "PV3", "GROUP2", True)
     add_block(ch, "TESTBLOCK4", "PV4", "NONE", True)
     blocks = ch.get_blocknames()
     self.assertEquals(len(blocks), 4)
     ch.clear_config()
     blocks = ch.get_blocknames()
     self.assertEquals(len(blocks), 0)
 def test_getting_blocks_json_with_no_blocks_returns_empty_list(self):
     # arrange
     ch = ConfigHolder(MACROS, MockVersionControl(), file_manager=MockConfigurationFileManager(), test_config=None)
     # act
     blocks = ch.get_blocknames()
     # assert
     self.assertEqual(len(blocks), 0)
    def test_empty_component_save_and_load(self):
        ch = ConfigHolder(MACROS, MockVersionControl(), file_manager=MockConfigurationFileManager(), test_config=Configuration(MACROS))
        ch.save_configuration("TESTCOMPONENT", True)
        ch.clear_config()

        conf = ch.load_configuration("TESTCOMPONENT", True)
        ch.set_config(conf, True)

        self.assertEqual(ch.get_config_name(), "TESTCOMPONENT")
        self.assertEqual(len(ch.get_blocknames()), 0)
        self.assertEqual(len(ch.get_group_details()), 0)
        self.assertEqual(len(ch.get_ioc_names()), 0)
        self.assertEqual(len(ch.get_component_names()), 0)