我试图让我们的身份验证(ember-simple-auth
)被模拟Pretender
以在我们的测试中运行,但由于某种原因,我收到以下错误:
Pretender intercepted POST http://api.dev/token but no handler was defined for this type of request
这是我目前的设置login-test.js
module('Integration - Login Page', {
setup: function() {
App = startApp();
server = new Pretender(function(){
this.get('http://api.dev/v1/accounts/current', function(request) {
var response = {
"message": "unauthorized"
};
return [401, { "Content-Type": "application/json" }, JSON.stringify(response)];
});
this.post('http://api.dev/token', function(request) {
var response = {
"access_token": "myaccesstoken==",
"token_type": "bearer"
};
return [200, { "Content-Type": "application/json" }, JSON.stringify(response)];
});
});
},
teardown: function() {
Ember.run(App, App.destroy);
server.shutdown();
}
});
有人知道为什么网址没有注册吗?