Ejemplo n.º 1
0
 def test_variable_replace_lookups_mixed(self):
     value = {
         "something": [
             "${output fakeStack::FakeOutput}",
             "other",
         ],
         "here": {
             "other": "${output fakeStack::FakeOutput2}",
             "same": "${output fakeStack::FakeOutput}",
             "mixed": "something:${output fakeStack::FakeOutput3}",
         },
     }
     var = Variable("Param1", value)
     self.assertEqual(len(var.lookups), 3)
     resolved_lookups = {
         mock_lookup("fakeStack::FakeOutput", "output"): "resolved",
         mock_lookup("fakeStack::FakeOutput2", "output"): "resolved2",
         mock_lookup("fakeStack::FakeOutput3", "output"): "resolved3",
     }
     var.replace(resolved_lookups)
     self.assertEqual(
         var.value, {
             "something": [
                 "resolved",
                 "other",
             ],
             "here": {
                 "other": "resolved2",
                 "same": "resolved",
                 "mixed": "something:resolved3",
             },
         })
Ejemplo n.º 2
0
 def test_variable_replace_no_lookups_list(self):
     var = Variable("Param1", ["something", "here"])
     self.assertEqual(len(var.lookups), 0)
     resolved_lookups = {
         mock_lookup("fakeStack::FakeOutput", "output"): "resolved",
     }
     var.replace(resolved_lookups)
     self.assertEqual(var.value, ["something", "here"])
Ejemplo n.º 3
0
 def test_variable_replace_simple_lookup(self):
     var = Variable("Param1", "${output fakeStack::FakeOutput}")
     self.assertEqual(len(var.lookups), 1)
     resolved_lookups = {
         mock_lookup("fakeStack::FakeOutput", "output"): "resolved",
     }
     var.replace(resolved_lookups)
     self.assertEqual(var.value, "resolved")
Ejemplo n.º 4
0
 def test_variable_replace_no_lookups(self):
     var = Variable("Param1", "2")
     self.assertEqual(len(var.lookups), 0)
     resolved_lookups = {
         mock_lookup("fakeStack::FakeOutput"): "resolved",
     }
     var.replace(resolved_lookups)
     self.assertEqual(var.value, "2")
Ejemplo n.º 5
0
 def test_variable_replace_lookups_list(self):
     value = ["something", "${fakeStack::FakeOutput}",
              "${fakeStack::FakeOutput2}"]
     var = Variable("Param1", value)
     self.assertEqual(len(var.lookups), 2)
     resolved_lookups = {
         mock_lookup("fakeStack::FakeOutput"): "resolved",
         mock_lookup("fakeStack::FakeOutput2"): "resolved2",
     }
     var.replace(resolved_lookups)
     self.assertEqual(var.value, ["something", "resolved", "resolved2"])
Ejemplo n.º 6
0
 def test_variable_replace_multiple_lookups_string(self):
     var = Variable(
         "Param1",
         "url://${fakeStack::FakeOutput}@${fakeStack::FakeOutput2}",
     )
     self.assertEqual(len(var.lookups), 2)
     resolved_lookups = {
         mock_lookup("fakeStack::FakeOutput"): "resolved",
         mock_lookup("fakeStack::FakeOutput2"): "resolved2",
     }
     var.replace(resolved_lookups)
     self.assertEqual(var.value, "url://resolved@resolved2")
Ejemplo n.º 7
0
 def test_variable_replace_lookups_dict(self):
     value = {
         "something": "${output fakeStack::FakeOutput}",
         "other": "${output fakeStack::FakeOutput2}",
     }
     var = Variable("Param1", value)
     self.assertEqual(len(var.lookups), 2)
     resolved_lookups = {
         mock_lookup("fakeStack::FakeOutput", "output"): "resolved",
         mock_lookup("fakeStack::FakeOutput2", "output"): "resolved2",
     }
     var.replace(resolved_lookups)
     self.assertEqual(var.value, {"something": "resolved", "other":
                                  "resolved2"})