[backend/webstore][s]: remove webstore backend.

This commit is contained in:
Rufus Pollock
2012-03-15 00:27:53 +00:00
parent 35631f3713
commit 95a394bd13
3 changed files with 1 additions and 178 deletions

View File

@@ -90,122 +90,6 @@ test('Memory Backend: update and delete', function () {
});
});
// TODO: move to fixtures
var webstoreSchema = {
"count": 3,
"data": [
{
"name": "__id__",
"type": "integer",
"values_url": "/rufuspollock/demo/data/distinct/__id__"
},
{
"name": "date",
"type": "text",
"values_url": "/rufuspollock/demo/data/distinct/date"
},
{
"name": "geometry",
"type": "text",
"values_url": "/rufuspollock/demo/data/distinct/geometry"
},
{
"name": "amount",
"type": "text",
"values_url": "/rufuspollock/demo/data/distinct/amount"
}
],
"fields": [
{
"name": "type"
},
{
"name": "name"
},
{
"name": "values_url"
}
]
};
webstoreData = {
"count": null,
"data": [
{
"__id__": 1,
"amount": "100",
"date": "2009-01-01",
"geometry": null
},
{
"__id__": 2,
"amount": "200",
"date": "2010-01-01",
"geometry": null
},
{
"__id__": 3,
"amount": "300",
"date": "2011-01-01",
"geometry": null
}
],
"fields": [
{
"name": "__id__"
},
{
"name": "date"
},
{
"name": "geometry"
},
{
"name": "amount"
}
]
};
test('Webstore Backend', function() {
var dataset = new recline.Model.Dataset({
id: 'my-id',
webstore_url: 'http://webstore.test.ckan.org/rufuspollock/demo/data'
},
'webstore'
);
var stub = sinon.stub($, 'ajax', function(options) {
if (options.url.indexOf('schema.json') != -1) {
return {
done: function(callback) {
callback(webstoreSchema);
return this;
},
fail: function() {
return this;
}
}
} else {
return {
done: function(callback) {
callback(webstoreData);
},
fail: function() {
}
}
}
});
dataset.fetch().done(function(dataset) {
deepEqual(['__id__', 'date', 'geometry', 'amount'], _.pluck(dataset.fields.toJSON(), 'id'));
equal(3, dataset.docCount)
dataset.query().done(function(docList) {
equal(3, docList.length)
equal("2009-01-01", docList.models[0].get('date'));
});
});
$.ajax.restore();
});
var dataProxyData = {
"data": [