Пример #1
0
 def test_retrieving_address_from_agent_file(self):
     # The API address is correctly retrieved from the machiner agent file.
     with self.agent_file([self.agent_address]) as (unit_dir, _):
         self.assertEqual(self.agent_address, get_api_address(unit_dir))
Пример #2
0
 def test_multiple_addresses_in_env(self):
     # If multiple API addresses are listed in the environment variable,
     # the first one is returned.
     addresses = "{} foo.example.com:42".format(self.env_address)
     with environ(JUJU_API_ADDRESSES=addresses):
         self.assertEqual(self.env_address, get_api_address())
Пример #3
0
 def test_both_env_and_agent_file(self):
     # If the API address is included in both the environment and the
     # agent.conf file, the environment variable takes precedence.
     with environ(JUJU_API_ADDRESSES=self.env_address):
         with self.agent_file([self.agent_address]) as (unit_dir, _):
             self.assertEqual(self.env_address, get_api_address(unit_dir))
Пример #4
0
 def test_multiple_addresses_in_agent_file(self):
     # If multiple API addresses are listed in the agent file, the first
     # one is returned.
     addresses = [self.agent_address, "foo.example.com:42"]
     with self.agent_file(addresses) as (unit_dir, _):
         self.assertEqual(self.agent_address, get_api_address(unit_dir))
Пример #5
0
 def test_retrieving_address_from_env(self):
     # The API address is correctly retrieved from the environment.
     with environ(JUJU_API_ADDRESSES=self.env_address):
         self.assertEqual(self.env_address, get_api_address())
Пример #6
0
 def test_retrieving_address_from_agent_file(self):
     # The API address is correctly retrieved from the machiner agent file.
     with self.agent_file([self.agent_address]) as (unit_dir, _):
         self.assertEqual(self.agent_address, get_api_address(unit_dir))
Пример #7
0
 def test_both_env_and_agent_file(self):
     # If the API address is included in both the environment and the
     # agent.conf file, the environment variable takes precedence.
     with environ(JUJU_API_ADDRESSES=self.env_address):
         with self.agent_file([self.agent_address]) as (unit_dir, _):
             self.assertEqual(self.env_address, get_api_address(unit_dir))
Пример #8
0
 def test_multiple_addresses_in_env(self):
     # If multiple API addresses are listed in the environment variable,
     # the first one is returned.
     addresses = '{} foo.example.com:42'.format(self.env_address)
     with environ(JUJU_API_ADDRESSES=addresses):
         self.assertEqual(self.env_address, get_api_address())
Пример #9
0
 def test_retrieving_address_from_env(self):
     # The API address is correctly retrieved from the environment.
     with environ(JUJU_API_ADDRESSES=self.env_address):
         self.assertEqual(self.env_address, get_api_address())
Пример #10
0
 def test_multiple_addresses_in_agent_file(self):
     # If multiple API addresses are listed in the agent file, the first
     # one is returned.
     addresses = [self.agent_address, 'foo.example.com:42']
     with self.agent_file(addresses) as (unit_dir, _):
         self.assertEqual(self.agent_address, get_api_address(unit_dir))