mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
These tested a transition that occured in February. The tests are very slow because each test does an uncached download of Meteor 0.7.0.1. We are unlikely to break the logic that it tests and even if we do, it will only affect users who haven't touched their apps since February.
64 lines
1.8 KiB
JavaScript
64 lines
1.8 KiB
JavaScript
var selftest = require('../selftest.js');
|
|
var testUtils = require('../test-utils.js');
|
|
var Sandbox = selftest.Sandbox;
|
|
var files = require('../files.js');
|
|
|
|
var commandTimeoutSecs = testUtils.accountsCommandTimeoutSecs;
|
|
|
|
var loggedInError = selftest.markStack(function(run) {
|
|
run.waitSecs(commandTimeoutSecs);
|
|
run.matchErr("You must be logged in to claim sites.");
|
|
run.expectExit(1);
|
|
});
|
|
|
|
var waitAndError = selftest.markStack(function(run, errmsg) {
|
|
run.waitSecs(commandTimeoutSecs);
|
|
run.matchErr(errmsg);
|
|
run.expectExit(1);
|
|
});
|
|
|
|
selftest.define("claim", ['net', 'slow'], function () {
|
|
var s = new Sandbox;
|
|
|
|
// Can't claim sites while logged out.
|
|
// Nonexistent site.
|
|
var run = s.run('claim', testUtils.randomAppName(20));
|
|
loggedInError(run);
|
|
|
|
// Can't claim sites without specifying a site
|
|
run = s.run('claim');
|
|
run.matchErr('not enough arguments');
|
|
run.expectExit(1);
|
|
|
|
// Existing site.
|
|
run = s.run('claim', 'mother-test');
|
|
loggedInError(run);
|
|
|
|
// Claim will not work on non-legacy sites.
|
|
// belongs to me.
|
|
testUtils.login(s, "test", "testtest");
|
|
var appName = testUtils.createAndDeployApp(s);
|
|
run = s.run('claim', appName);
|
|
waitAndError(run, "That site already belongs to you.");
|
|
|
|
// belongs to not me.
|
|
testUtils.logout(s);
|
|
testUtils.login(s, "testtest", "testtest");
|
|
run = s.run('claim', appName);
|
|
waitAndError(run, "Sorry, that site belongs to someone else.");
|
|
|
|
// belongs to not me, but I am authorized.
|
|
testUtils.logout(s);
|
|
testUtils.login(s, "test", "testtest");
|
|
run = s.run('authorized', appName, '--add', 'testtest');
|
|
run.waitSecs(commandTimeoutSecs);
|
|
run.match('added');
|
|
run.expectExit(0);
|
|
testUtils.logout(s);
|
|
testUtils.login(s, "testtest", "testtest");
|
|
run = s.run('claim', appName);
|
|
waitAndError(run, "That site already belongs to you.");
|
|
|
|
testUtils.cleanUpApp(s, appName);
|
|
});
|