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')
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')
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())
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 )
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 )
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'] )