def test_get_names_no_env(self):
     args = mock.Mock()
     args.env = None
     args.bmc_prefix = 'bmc-foo'
     args.baremetal_prefix = 'baremetal-foo'
     args.provision_net = 'provision-foo'
     bmc_base, baremetal_base, provision_net = build_nodes_json._get_names(
         args)
     self.assertEqual('bmc-foo', bmc_base)
     self.assertEqual('baremetal-foo', baremetal_base)
     self.assertEqual('provision-foo', provision_net)
 def test_get_names_no_env(self):
     args = mock.Mock()
     args.env = None
     args.bmc_prefix = 'bmc-foo'
     args.baremetal_prefix = 'baremetal-foo'
     args.provision_net = 'provision-foo'
     bmc_base, baremetal_base, provision_net = build_nodes_json._get_names(
         args)
     self.assertEqual('bmc-foo', bmc_base)
     self.assertEqual('baremetal-foo', baremetal_base)
     self.assertEqual('provision-foo', provision_net)
 def test_get_names_no_env_w_undercloud(self):
     args = mock.Mock()
     args.env = None
     args.bmc_prefix = 'bmc-foo'
     args.baremetal_prefix = 'baremetal-foo'
     args.add_undercloud = True
     bmc_base, baremetal_base, undercloud_name = (
         build_nodes_json._get_names(args))
     self.assertEqual('bmc-foo', bmc_base)
     self.assertEqual('baremetal-foo', baremetal_base)
     self.assertEqual('undercloud', undercloud_name)
 def test_get_names_no_env(self):
     args = mock.Mock()
     args.env = None
     args.bmc_prefix = 'bmc-foo'
     args.baremetal_prefix = 'baremetal-foo'
     args.provision_net = 'provision-foo'
     args.add_undercloud = False
     bmc_base, baremetal_base, provision_net, undercloud_name = (
         build_nodes_json._get_names(args))
     self.assertEqual('bmc-foo', bmc_base)
     self.assertEqual('baremetal-foo', baremetal_base)
     self.assertEqual('provision-foo', provision_net)
     self.assertEqual('undercloud', undercloud_name)
 def test_get_names_env(self, mock_load, mock_open):
     args = mock.Mock()
     args.env = 'foo.yaml'
     mock_env = {'parameters':
                     {'bmc_prefix': 'bmc-foo',
                      'baremetal_prefix': 'baremetal-foo',
                      'provision_net': 'provision-foo'
                      }
                 }
     mock_load.return_value = mock_env
     bmc_base, baremetal_base, provision_net = build_nodes_json._get_names(
         args)
     self.assertEqual('bmc-foo', bmc_base)
     self.assertEqual('baremetal-foo', baremetal_base)
     self.assertEqual('provision-foo', provision_net)
 def test_get_names_env(self, mock_load, mock_open):
     args = mock.Mock()
     args.env = 'foo.yaml'
     mock_env = {
         'parameters': {
             'bmc_prefix': 'bmc-foo',
             'baremetal_prefix': 'baremetal-foo',
             'provision_net': 'provision-foo'
         }
     }
     mock_load.return_value = mock_env
     bmc_base, baremetal_base, provision_net = build_nodes_json._get_names(
         args)
     self.assertEqual('bmc-foo', bmc_base)
     self.assertEqual('baremetal-foo', baremetal_base)
     self.assertEqual('provision-foo', provision_net)
 def test_get_names_env(self, mock_load, mock_open):
     args = mock.Mock()
     args.env = 'foo.yaml'
     args.add_undercloud = False
     mock_env = {
         'parameter_defaults': {
             'bmc_prefix': 'bmc-foo',
             'baremetal_prefix': 'baremetal-foo',
         },
     }
     mock_load.return_value = mock_env
     bmc_base, baremetal_base, undercloud_name = (
         build_nodes_json._get_names(args))
     self.assertEqual('bmc-foo', bmc_base)
     self.assertEqual('baremetal-foo', baremetal_base)
     self.assertIsNone(undercloud_name)
Beispiel #8
0
 def test_get_names_env_strip_role(self, mock_load, mock_open):
     args = mock.Mock()
     args.env = 'foo.yaml'
     args.add_undercloud = False
     mock_env = {
         'parameters': {
             'bmc_prefix': 'bmc-foo',
             'baremetal_prefix': 'baremetal-foo-bar',
             'provision_net': 'provision-foo'
         },
         'parameter_defaults': {
             'role': 'bar'
         }
     }
     mock_load.return_value = mock_env
     bmc_base, baremetal_base, provision_net, undercloud_name = (
         build_nodes_json._get_names(args))
     self.assertEqual('bmc-foo', bmc_base)
     self.assertEqual('baremetal-foo', baremetal_base)
     self.assertEqual('provision-foo', provision_net)
     self.assertIsNone(undercloud_name)