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

        with pytest.raises(LookupError) as excinfo:
            p.get_storage(0)

        assert "storage" in str(excinfo.value)
Example #2
0
    def test_get_storage_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_storage(2)

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

        assert p.get_storage(1) == s1