def test_get_bam_ip_in_config_file_list(self, mock_os, mock_user_config): mock_os.environ = {'no_bam_ip': ''} mock_user_config.api_url = [('1.2.3.4', 'http://172.27.19.203/Services/API?wsdl')] expect = '1.2.3.4' actual = common.get_bam_ip() self.assertEqual(expect, actual)
def test_get_bam_ip_exception(self, mock_os, mock_hasattr): mock_os.environ = {'no_bam_ip': ''} mock_hasattr.return_value = False with self.assertRaises(Exception): common.get_bam_ip()
def test_get_bam_ip_in_os_environ_http(self, mock_os): mock_os.environ = {'BAM_IP': 'http://1.1.1.2/Services/API?wsdl'} expect = '1.1.1.2' actual = common.get_bam_ip() self.assertEqual(expect, actual)