that simulates the behavior of a real method/object. • A mock is an object that we can set expectations on, and which will verify that the expected actions have indeed occurred. ͳΔ΄Ͳ... 15 JAWS-UGԬɿRebootˌ4ɺߥ͞ΜͱAWSͷΛͯ͠ΈͨΓ JAWS DAYS ࢀՃऀ͔ΒΛ͖͍ͯΈͨΓ͠Α͏
that allows your python tests to easily mock out the boto library. • Moto Python ςετͰ boto ϥΠϒϥϦΛ؆୯ʹ฿Ͱ͖ΔΑ ͏ʹ͢ΔϥΠϒϥϦͰ͢(Powerded by Google ༁) • શͯͷαʔϏεαϙʔτ͞Ε͍ͯͳ͍͕ɺओཁͳαʔϏε ཏ͞Ε͍ͯΔ༷ 20 JAWS-UGԬɿRebootˌ4ɺߥ͞ΜͱAWSͷΛͯ͠ΈͨΓ JAWS DAYS ࢀՃऀ͔ΒΛ͖͍ͯΈͨΓ͠Α͏
import mock_ec2 ... @mock_ec2 def test_list_ec2_instances(self): instances = [e for e in list_ec2_instances()] self.assertEqual([], instances) 22 JAWS-UGԬɿRebootˌ4ɺߥ͞ΜͱAWSͷΛͯ͠ΈͨΓ JAWS DAYS ࢀՃऀ͔ΒΛ͖͍ͯΈͨΓ͠Α͏
Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) $ moto_server s3 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) 26 JAWS-UGԬɿRebootˌ4ɺߥ͞ΜͱAWSͷΛͯ͠ΈͨΓ JAWS DAYS ࢀՃऀ͔ΒΛ͖͍ͯΈͨΓ͠Α͏