forked from github/server
skip excessive password generation in tests.
This commit is contained in:
parent
ae05d6d9e9
commit
f513c2c68a
4 changed files with 11 additions and 6 deletions
|
@ -934,7 +934,8 @@ static void seed_player(state *st, const newfaction *player) {
|
||||||
if (r) {
|
if (r) {
|
||||||
const char *at = strchr(player->email, '@');
|
const char *at = strchr(player->email, '@');
|
||||||
faction *f;
|
faction *f;
|
||||||
addplayer(r, f = addfaction(player->email, player->password,
|
const char *password = player->password ? player->password : itoa36(rng_int());
|
||||||
|
addplayer(r, f = addfaction(player->email, password,
|
||||||
player->race, player->lang,
|
player->race, player->lang,
|
||||||
player->subscription));
|
player->subscription));
|
||||||
if (at) {
|
if (at) {
|
||||||
|
|
|
@ -245,6 +245,7 @@ faction *addfaction(const char *email, const char *password,
|
||||||
f->alliance_joindate = turn;
|
f->alliance_joindate = turn;
|
||||||
f->lastorders = turn;
|
f->lastorders = turn;
|
||||||
f->_alive = true;
|
f->_alive = true;
|
||||||
|
f->_password = NULL;
|
||||||
f->age = 0;
|
f->age = 0;
|
||||||
f->race = frace;
|
f->race = frace;
|
||||||
f->magiegebiet = 0;
|
f->magiegebiet = 0;
|
||||||
|
@ -252,9 +253,10 @@ faction *addfaction(const char *email, const char *password,
|
||||||
f->subscription = subscription;
|
f->subscription = subscription;
|
||||||
f->flags = FFL_ISNEW|FFL_PWMSG;
|
f->flags = FFL_ISNEW|FFL_PWMSG;
|
||||||
|
|
||||||
if (!password) password = itoa36(rng_int());
|
if (password) {
|
||||||
faction_setpassword(f, password_encode(password, PASSWORD_DEFAULT));
|
faction_setpassword(f, password_encode(password, PASSWORD_DEFAULT));
|
||||||
ADDMSG(&f->msgs, msg_message("changepasswd", "value", password));
|
ADDMSG(&f->msgs, msg_message("changepasswd", "value", password));
|
||||||
|
}
|
||||||
|
|
||||||
f->options =
|
f->options =
|
||||||
WANT_OPTION(O_REPORT) | WANT_OPTION(O_ZUGVORLAGE) |
|
WANT_OPTION(O_REPORT) | WANT_OPTION(O_ZUGVORLAGE) |
|
||||||
|
|
|
@ -112,7 +112,7 @@ static void test_addfaction(CuTest *tc) {
|
||||||
test_setup();
|
test_setup();
|
||||||
rc = rc_get_or_create("human");
|
rc = rc_get_or_create("human");
|
||||||
lang = test_create_locale();
|
lang = test_create_locale();
|
||||||
f = addfaction("test@eressea.de", "hurrdurr", rc, lang, 1234);
|
f = addfaction("test@eressea.de", NULL, rc, lang, 1234);
|
||||||
CuAssertPtrNotNull(tc, f);
|
CuAssertPtrNotNull(tc, f);
|
||||||
CuAssertPtrNotNull(tc, f->name);
|
CuAssertPtrNotNull(tc, f->name);
|
||||||
CuAssertPtrEquals(tc, NULL, (void *)f->units);
|
CuAssertPtrEquals(tc, NULL, (void *)f->units);
|
||||||
|
|
|
@ -550,13 +550,15 @@ int autoseed(newfaction ** players, int nsize, int max_agediff)
|
||||||
newfaction **nfp, *nextf = *players;
|
newfaction **nfp, *nextf = *players;
|
||||||
faction *f;
|
faction *f;
|
||||||
unit *u;
|
unit *u;
|
||||||
|
const char * password;
|
||||||
|
|
||||||
isize += REGIONS_PER_FACTION;
|
isize += REGIONS_PER_FACTION;
|
||||||
terraform_region(r, preferred_terrain(nextf->race));
|
terraform_region(r, preferred_terrain(nextf->race));
|
||||||
prepare_starting_region(r);
|
prepare_starting_region(r);
|
||||||
++tsize;
|
++tsize;
|
||||||
assert(r->land && r->units == 0);
|
assert(r->land && r->units == 0);
|
||||||
u = addplayer(r, addfaction(nextf->email, nextf->password, nextf->race,
|
password = nextf->password ? nextf->password : itoa36(rng_int());
|
||||||
|
u = addplayer(r, addfaction(nextf->email, password, nextf->race,
|
||||||
nextf->lang, nextf->subscription));
|
nextf->lang, nextf->subscription));
|
||||||
f = u->faction;
|
f = u->faction;
|
||||||
fset(f, FFL_ISNEW);
|
fset(f, FFL_ISNEW);
|
||||||
|
|
Loading…
Reference in a new issue