Exemplo n.º 1
0
 def test_view(self, check_output):
     check_output.return_value = raw
     client = Client()
     response = client.get(reverse("status"))
     self.assertEqual(response.status_code, 200)
     output = yaml.load(raw, Loader=yaml.Loader)
     machines = extract_machines(output)
     services = extract_services(output)
     self.assertListEqual(response.context['machines'], machines)
     self.assertListEqual(response.context['services'], services)
     check_output.assert_called_with(["juju", "status"])
Exemplo n.º 2
0
 def test_machines(self):
     output = yaml.load(raw, Loader=yaml.Loader)
     data = extract_machines(output)
     expected = [
         (0, "running", "running"),
         (128, "running", "running"),
         (129, "running", "running"),
         (142, "running", "running"),
         (113, "running", "running"),
         (114, "running", "running"),
         (147, "running", "running"),
         (127, "running", "running"),
     ]
     self.assertListEqual(data, expected)