def test_make_auto_deployable_no_swagger(self, LogicalIdGeneratorMock): prefix = "prefix" stage = MagicMock() deployment = ApiGatewayDeployment(logical_id=prefix) deployment.make_auto_deployable(stage, swagger=None) self.assertEquals(deployment.logical_id, prefix) self.assertEquals(deployment.Description, None) LogicalIdGeneratorMock.assert_not_called() stage.update_deployment_ref.assert_not_called()
def test_make_auto_deployable_no_swagger(self, LogicalIdGeneratorMock): prefix = "prefix" stage = MagicMock() deployment = ApiGatewayDeployment(logical_id=prefix) deployment.make_auto_deployable(stage, swagger=None) self.assertEqual(deployment.logical_id, prefix) self.assertEqual(deployment.Description, None) LogicalIdGeneratorMock.assert_not_called() stage.update_deployment_ref.assert_not_called()
def test_make_auto_deployable_with_swagger_dict(self, LogicalIdGeneratorMock): prefix = "prefix" generator_mock = LogicalIdGeneratorMock.return_value stage = MagicMock() id_val = "SomeLogicalId" full_hash = "127e3fb91142ab1ddc5f5446adb094442581a90d" generator_mock.gen.return_value = id_val generator_mock.get_hash.return_value = full_hash swagger = {"a": "b"} deployment = ApiGatewayDeployment(logical_id=prefix) deployment.make_auto_deployable(stage, swagger=swagger) self.assertEqual(deployment.logical_id, id_val) self.assertEqual(deployment.Description, "RestApi deployment id: {}".format(full_hash)) LogicalIdGeneratorMock.assert_called_once_with(prefix, str(swagger)) generator_mock.gen.assert_called_once_with() generator_mock.get_hash.assert_called_once_with(length=40) # getting full SHA stage.update_deployment_ref.assert_called_once_with(id_val)