def test_no_constraints(self): get_current_ami_m = self.mocker.replace(get_current_ami) get_current_ami_m(region="us-east-1") self.mocker.result(succeed("ami-giggle")) self.mocker.replay() d = get_image_id({}, {}) d.addCallback(self.assertEquals, "ami-giggle") return d
def test_default_series(self): get_current_ami_m = self.mocker.replace(get_current_ami) get_current_ami_m(region="us-east-1", ubuntu_release="puissant") self.mocker.result(succeed("ami-pickle")) self.mocker.replay() d = get_image_id({"default-series": "puissant"}, {}) d.addCallback(self.assertEquals, "ami-pickle") return d
def test_uses_constraints(self): get_current_ami_m = self.mocker.replace(get_current_ami) get_current_ami_m(ubuntu_release="serendipitous", architecture="x512", daily=False, persistent_storage=True, region="blah-north-6") self.mocker.result(succeed("ami-tinkle")) self.mocker.replay() constraints = { "architecture": "x512", "ubuntu_release": "serendipitous", "persistent_storage": True, "daily": False} d = get_image_id( {"region": "blah-north-6", "default-series": "overridden"}, constraints) d.addCallback(self.assertEquals, "ami-tinkle") return d
def test_uses_constraints(self): get_current_ami_m = self.mocker.replace(get_current_ami) get_current_ami_m(ubuntu_release="serendipitous", architecture="x512", daily=False, persistent_storage=True, region="blah-north-6") self.mocker.result(succeed("ami-tinkle")) self.mocker.replay() constraints = { "architecture": "x512", "ubuntu_release": "serendipitous", "persistent_storage": True, "daily": False } d = get_image_id( { "region": "blah-north-6", "default-series": "overridden" }, constraints) d.addCallback(self.assertEquals, "ami-tinkle") return d
def test_default_image_id(self): d = get_image_id({"default-image-id": "ami-burble"}, {}) d.addCallback(self.assertEquals, "ami-burble") return d