草庐IT

NewContext

全部标签

google-app-engine - aetest.NewContext() 是否需要参数?

我正在学习如何为Appengine应用创建Golang测试。文档示例对我来说没有意义。https://cloud.google.com/appengine/docs/standard/go/tools/localunittesting/reference文档似乎说你可以创建一个上下文:=aetest.NewContext()当我尝试这样做时,我收到一个错误,提示aetest.NewContext需要参数。$gotest-v./skincare_test.go:12:notenoughargumentsincalltoaetest.NewContexthave()want(*aetest

unit-testing - 使用 aetest.NewContext 代替 endpoints.NewContext 以强一致性测试 go-endpoints

我有一个搜索方法:func(sa*SearchApi)Search(cendpoints.Context,r*SearchQuery)(*SearchResults,error){..}如您所见,它需要一个端点。上下文例如:ctx:=endpoints.NewContext(req1)但是对于aetest,我使用的是不同的上下文:otherCtx,err:=aetest.NewContext(&aetest.Options{"",true})特别是这个上下文有额外的强一致性选项-因为我正在设置数据所以我可以测试一个只读的api。我无法将otherCxt传递给我的Search方法,因为它

c# - 如何使用 Entity Framework 更新特定记录的一个字段?

我想更新一个人的家人,他的名字叫pejman。这是我的对象类:publicclassPerson{publicintId{get;set;}publicstringFirstName{get;set;}publicstringLastName{get;set;}publicDateTimeBirthDate{get;set;}publicboolIsMale{get;set;}publicbyte[]Image{get;set;}publicbyte[]RowVersion{get;set;}publicvirtualPersonParent{get;set;}publicvirtua

c++ - JS_NewContext 中的 JSAPI 段错误

我正在编写一个嵌入SpiderMonkey的简单C++程序。不幸的是,它在JS_NewContext()中出现段错误。程序(保存为jsapi_use.cpp):#define__STDC_LIMIT_MACROS#include#include#includestaticJSClassglobal_class={#if0.name="global",.flags=JSCLASS_GLOBAL_FLAGS,.addProperty=nullptr,.delProperty=nullptr,.getProperty=nullptr,.setProperty=nullptr,.enumera

google-app-engine - Go Gae NewContext

我在GAE上使用Go。我的任务之一是发送电子邮件。我正在使用this文档测试成功。但是,如果我不想要请求处理程序怎么办:funcconfirm(whttp.ResponseWriter,r*http.Request){c:=appengine.NewContext(r)...而是通过本地函数发送电子邮件:funcconfirm(){...在Go中有什么方法可以用GAE做到这一点吗?我认为我正在寻找的是一种调用方式:c:=appengine.NewContext(r)但是没有请求处理程序,或者以任何可能的方式绕过它(我读到的可能是不可能的)我在想一个解决办法是制作一个httpreques

google-app-engine - Go Gae NewContext

我在GAE上使用Go。我的任务之一是发送电子邮件。我正在使用this文档测试成功。但是,如果我不想要请求处理程序怎么办:funcconfirm(whttp.ResponseWriter,r*http.Request){c:=appengine.NewContext(r)...而是通过本地函数发送电子邮件:funcconfirm(){...在Go中有什么方法可以用GAE做到这一点吗?我认为我正在寻找的是一种调用方式:c:=appengine.NewContext(r)但是没有请求处理程序,或者以任何可能的方式绕过它(我读到的可能是不可能的)我在想一个解决办法是制作一个httpreques

google-app-engine - golang appengine api测试错误 "appengine: NewContext passed an unknown http.Request"

我正在使用appengine和golang开发简单的RESTfulAPI。当我使用goappserve开始服务时代码工作正常,我开始编写单元测试函数来测试API端点,我在这里遇到了panic错误appengine:NewContextpassedanunknownhttp.Request。我在运行goapptest时遇到此错误。看起来由于某种原因,我无法传递我创建的请求并将其传递给appengine.NewContext()下面是代码片段..body:=strings.NewReader("")request,err:=http.NewRequest("GET","endpointur

google-app-engine - golang appengine api测试错误 "appengine: NewContext passed an unknown http.Request"

我正在使用appengine和golang开发简单的RESTfulAPI。当我使用goappserve开始服务时代码工作正常,我开始编写单元测试函数来测试API端点,我在这里遇到了panic错误appengine:NewContextpassedanunknownhttp.Request。我在运行goapptest时遇到此错误。看起来由于某种原因,我无法传递我创建的请求并将其传递给appengine.NewContext()下面是代码片段..body:=strings.NewReader("")request,err:=http.NewRequest("GET","endpointur

google-app-engine - 在托管虚拟机的本地开发环境中运行 Web 应用程序时出现 appengine.NewContext 错误

我正在尝试在我的开发环境中使用本地托管虚拟机运行应用引擎的演示之一。当代码尝试为请求创建新上下文(appengine.NewContext(r))时,请求会因panic而失败:funchandle(whttp.ResponseWriter,r*http.Request){ifr.URL.Path!="/"{http.NotFound(w,r)return}c:=appengine.NewContext(r)log.Infof(c,"Servingthefrontpage.")tmpl.Execute(w,time.Since(initTime))}appengine.NewContex