Example #1
0
    def test_get_host_not_found_must_raise(self):
        h1 = Host(0, "n")
        s1 = Storage(1, "n")
        p = Platform([h1, s1])

        with pytest.raises(LookupError) as excinfo:
            p.get_host(2)

        assert "resources" in str(excinfo.value)
Example #2
0
    def test_get_host_with_storage_id_must_raise(self):
        h1 = Host(0, "n")
        s1 = Storage(1, "n")
        p = Platform([h1, s1])

        with pytest.raises(LookupError) as excinfo:
            p.get_host(1)

        assert "host" in str(excinfo.value)
Example #3
0
    def test_get_host_by_id(self):
        h1 = Host(0, "n")
        s1 = Storage(1, "n")
        p = Platform([h1, s1])

        assert p.get_host(0) == h1