Пример #1
0
    def test_validate(self):
        with pytest.raises(ValueError):
            c = CmdHostCreate()
            c.validate()

        with pytest.raises(ValueError):
            c = CmdHostCreate()
            c.ami("ami")
            c.distro("distro")
            c.validate()

        with pytest.raises(ValueError):
            c = CmdHostCreate()
            c.ami("ami")
            c.validate()

        with pytest.raises(ValueError):
            c = CmdHostCreate()
            c.ami("ami")
            c.instance_type("type")
            c.validate()

        with pytest.raises(ValueError):
            c = CmdHostCreate()
            c.ami("ami")
            c.instance_type("type")
            c.security_group_id("id")
            c.validate()

        with pytest.raises(ValueError):
            c = CmdHostCreate()
            c.distro("distro")
            c.aws_id("id")
            c.validate()

        with pytest.raises(ValueError):
            c = CmdHostCreate()
            c.distro("distro")
            c.aws_id("id")
            c.aws_secret("secret")
            c.validate()

        with pytest.raises(ValueError):
            c = CmdHostCreate()
            c.distro("distro")
            c.aws_secret("secret")
            c.validate()

        with pytest.raises(ValueError):
            c = CmdHostCreate()
            c.distro("distro")
            c.key_name("key")
            c.validate()

        c = CmdHostCreate()
        c.distro("distro")
        c.validate()
Пример #2
0
    def test_invalid_aws_id(self):
        c = CmdHostCreate()

        with pytest.raises(TypeError):
            c.aws_id(42)