2017-04-19 21:15:28 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const assert = require('assert');
|
|
|
|
const crypto = require('crypto');
|
2013-12-19 16:11:54 +01:00
|
|
|
|
|
|
|
function readfile(x) {
|
2017-04-19 21:15:28 +02:00
|
|
|
return require('fs').readFileSync(__dirname + '/' + x);
|
2013-12-19 16:11:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = function() {
|
2017-08-06 21:54:15 +02:00
|
|
|
const server = process.server;
|
|
|
|
const server2 = process.server2;
|
2013-12-29 07:40:47 +01:00
|
|
|
|
2017-04-19 21:15:28 +02:00
|
|
|
it('downloading non-existent tarball #1 / srv2', function() {
|
2017-06-28 22:56:02 +02:00
|
|
|
return server2.getTarball('testpkg-gh29', 'blahblah')
|
2015-04-11 19:11:04 +02:00
|
|
|
.status(404)
|
2017-04-19 21:15:28 +02:00
|
|
|
.body_error(/no such package/);
|
|
|
|
});
|
2013-12-19 16:11:54 +01:00
|
|
|
|
2014-11-12 12:14:37 +01:00
|
|
|
describe('pkg-gh29', function() {
|
2017-04-19 21:15:28 +02:00
|
|
|
before(function() {
|
2017-08-06 21:54:15 +02:00
|
|
|
return server.putPackage('testpkg-gh29', require('./fixtures/package')('testpkg-gh29'))
|
2015-04-11 19:11:04 +02:00
|
|
|
.status(201)
|
2017-04-19 21:15:28 +02:00
|
|
|
.body_ok(/created new package/);
|
|
|
|
});
|
2013-12-19 16:11:54 +01:00
|
|
|
|
2017-04-19 21:15:28 +02:00
|
|
|
it('creating new package / srv1', function() {});
|
2013-12-19 16:11:54 +01:00
|
|
|
|
2017-04-19 21:15:28 +02:00
|
|
|
it('downloading non-existent tarball #2 / srv2', function() {
|
2017-06-28 22:56:02 +02:00
|
|
|
return server2.getTarball('testpkg-gh29', 'blahblah')
|
2015-04-11 19:11:04 +02:00
|
|
|
.status(404)
|
2017-04-19 21:15:28 +02:00
|
|
|
.body_error(/no such file/);
|
|
|
|
});
|
2013-12-19 16:11:54 +01:00
|
|
|
|
2014-11-12 12:14:37 +01:00
|
|
|
describe('tarball', function() {
|
2017-04-19 21:15:28 +02:00
|
|
|
before(function() {
|
2017-06-28 22:56:02 +02:00
|
|
|
return server.putTarball('testpkg-gh29', 'blahblah', readfile('fixtures/binary'))
|
2015-04-11 19:11:04 +02:00
|
|
|
.status(201)
|
2017-04-19 21:15:28 +02:00
|
|
|
.body_ok(/.*/);
|
|
|
|
});
|
2013-12-19 16:11:54 +01:00
|
|
|
|
2017-04-19 21:15:28 +02:00
|
|
|
it('uploading new tarball / srv1', function() {});
|
2013-12-19 16:11:54 +01:00
|
|
|
|
2014-11-12 12:14:37 +01:00
|
|
|
describe('pkg version', function() {
|
2017-04-19 21:15:28 +02:00
|
|
|
before(function() {
|
2017-08-06 21:54:15 +02:00
|
|
|
const pkg = require('./fixtures/package')('testpkg-gh29');
|
|
|
|
|
2017-04-19 21:15:28 +02:00
|
|
|
pkg.dist.shasum = crypto.createHash('sha1').update(readfile('fixtures/binary')).digest('hex');
|
2017-06-28 22:56:02 +02:00
|
|
|
return server.putVersion('testpkg-gh29', '0.0.1', pkg)
|
2015-04-11 19:11:04 +02:00
|
|
|
.status(201)
|
2017-04-19 21:15:28 +02:00
|
|
|
.body_ok(/published/);
|
|
|
|
});
|
2013-12-19 16:11:54 +01:00
|
|
|
|
2017-04-19 21:15:28 +02:00
|
|
|
it('uploading new package version / srv1', function() {});
|
2013-12-19 16:11:54 +01:00
|
|
|
|
2017-04-19 21:15:28 +02:00
|
|
|
it('downloading newly created tarball / srv2', function() {
|
2017-06-28 22:56:02 +02:00
|
|
|
return server2.getTarball('testpkg-gh29', 'blahblah')
|
2015-04-11 19:11:04 +02:00
|
|
|
.status(200)
|
2017-04-19 21:15:28 +02:00
|
|
|
.then(function(body) {
|
|
|
|
assert.deepEqual(body, readfile('fixtures/binary'));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
2013-12-19 16:11:54 +01:00
|
|
|
|