Esempio 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))
Esempio 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())
Esempio 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))
Esempio 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))
Esempio 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())
Esempio 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))
Esempio 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))
Esempio 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())
Esempio 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())
Esempio 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))