예제 #1
0
    def test_get_token(self):
        with open(mock_file_name, 'w') as f:
            f.write(file_ok)

        config = Config()
        config.conf = mock_file_name
        self.assertEqual(config.get_token(), 'some-token-1234')
예제 #2
0
    def test_get_hostname(self):
        with open(mock_file_name, 'w') as f:
            f.write(file_ok)

        config = Config()
        config.conf = mock_file_name
        self.assertEqual(config.get_hostname(), 'egi.tenant.com')
예제 #3
0
    def test_read(self):
        with open(mock_file_name, 'w') as f:
            f.write(file_ok)

        config = Config()
        config.conf = mock_file_name

        self.assertTrue(config.read())
예제 #4
0
    def test_get_hostname_no_section(self):
        with open(mock_file_name, 'w') as f:
            f.write(file_missing_general)

        config = Config()
        config.conf = mock_file_name
        self.assertRaises(
            ConfigParser.NoSectionError,
            config.get_hostname
        )
예제 #5
0
    def test_get_profiles_no_option(self):
        with open(mock_file_name, 'w') as f:
            f.write(file_missing_mp)

        config = Config()
        config.conf = mock_file_name
        self.assertRaises(
            ConfigParser.NoOptionError,
            config.get_profiles
        )
예제 #6
0
    def test_get_profiles(self):
        with open(mock_file_name, 'w') as f:
            f.write(file_ok)

        config = Config()
        config.conf = mock_file_name

        self.assertEqual(
            config.get_profiles(), ['TEST_PROFILE1', 'TEST_PROFILE2']
        )