Ejemplo n.º 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))
Ejemplo n.º 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())
Ejemplo n.º 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))
Ejemplo n.º 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))
Ejemplo n.º 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())
Ejemplo n.º 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))
Ejemplo n.º 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))
Ejemplo n.º 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())
Ejemplo n.º 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())
Ejemplo n.º 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))