disable sending of emails when running tests completely when run on travis
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -35,6 +35,8 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
|
|||||||
* optional email address to send account information to, default is the account that is being created
|
* optional email address to send account information to, default is the account that is being created
|
||||||
* @param int $email_quota
|
* @param int $email_quota
|
||||||
* optional quota if enabled in MB, default 0
|
* optional quota if enabled in MB, default 0
|
||||||
|
* @param bool $sendinfomail
|
||||||
|
* optional, sends the welcome message to the new account (needed for creation, without the user won't be able to login before any mail is received), default 1 (true)
|
||||||
*
|
*
|
||||||
* @access admin, customer
|
* @access admin, customer
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@@ -55,6 +57,7 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
|
|||||||
$email_password = $this->getParam('email_password');
|
$email_password = $this->getParam('email_password');
|
||||||
$alternative_email = $this->getParam('alternative_email', true, '');
|
$alternative_email = $this->getParam('alternative_email', true, '');
|
||||||
$quota = $this->getParam('email_quota', true, 0);
|
$quota = $this->getParam('email_quota', true, 0);
|
||||||
|
$sendinfomail = $this->getParam('sendinfomail', true, 1);
|
||||||
|
|
||||||
// validation
|
// validation
|
||||||
$quota = validate($quota, 'email_quota', '/^\d+$/', 'vmailquotawrong', array(), true);
|
$quota = validate($quota, 'email_quota', '/^\d+$/', 'vmailquotawrong', array(), true);
|
||||||
@@ -184,6 +187,7 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
|
|||||||
Admins::increaseUsage($customer['adminid'], 'email_accounts_used');
|
Admins::increaseUsage($customer['adminid'], 'email_accounts_used');
|
||||||
Admins::increaseUsage($customer['adminid'], 'email_quota_used', '', $quota);
|
Admins::increaseUsage($customer['adminid'], 'email_quota_used', '', $quota);
|
||||||
|
|
||||||
|
if ($sendinfomail) {
|
||||||
// replacer array for mail to create account on server
|
// replacer array for mail to create account on server
|
||||||
$replace_arr = array(
|
$replace_arr = array(
|
||||||
'EMAIL' => $email_full,
|
'EMAIL' => $email_full,
|
||||||
@@ -258,6 +262,7 @@ class EmailAccounts extends ApiCommand implements ResourceEntity
|
|||||||
|
|
||||||
$this->mailer()->ClearAddresses();
|
$this->mailer()->ClearAddresses();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->logger()->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_INFO, "[API] added email account for '" . $result['email_full'] . "'");
|
$this->logger()->logAction($this->isAdmin() ? ADM_ACTION : USR_ACTION, LOG_INFO, "[API] added email account for '" . $result['email_full'] . "'");
|
||||||
$result = $this->apiCall('Emails.get', array(
|
$result = $this->apiCall('Emails.get', array(
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class CustomersTest extends TestCase
|
|||||||
'mysqls' => 15,
|
'mysqls' => 15,
|
||||||
'createstdsubdomain' => 1,
|
'createstdsubdomain' => 1,
|
||||||
'new_customer_password' => 'h0lYmo1y',
|
'new_customer_password' => 'h0lYmo1y',
|
||||||
'sendpassword' => 1,
|
'sendpassword' => TRAVIS_CI == 1 ? 0 : 1,
|
||||||
'phpenabled' => 1,
|
'phpenabled' => 1,
|
||||||
'store_defaultindex' => 1,
|
'store_defaultindex' => 1,
|
||||||
'custom_notes' => 'secret',
|
'custom_notes' => 'secret',
|
||||||
|
|||||||
@@ -372,7 +372,8 @@ class MailsTest extends TestCase
|
|||||||
'emailaddr' => 'info@test2.local',
|
'emailaddr' => 'info@test2.local',
|
||||||
'email_password' => generatePassword(),
|
'email_password' => generatePassword(),
|
||||||
'alternative_email' => 'noone@example.com',
|
'alternative_email' => 'noone@example.com',
|
||||||
'email_quota' => 1337
|
'email_quota' => 1337,
|
||||||
|
'sendinfomail' => TRAVIS_CI == 1 ? 0 : 1
|
||||||
];
|
];
|
||||||
$json_result = EmailAccounts::getLocal($customer_userdata, $data)->add();
|
$json_result = EmailAccounts::getLocal($customer_userdata, $data)->add();
|
||||||
$result = json_decode($json_result, true)['data'];
|
$result = json_decode($json_result, true)['data'];
|
||||||
@@ -452,7 +453,8 @@ class MailsTest extends TestCase
|
|||||||
$data = [
|
$data = [
|
||||||
'emailaddr' => 'info@test2.local',
|
'emailaddr' => 'info@test2.local',
|
||||||
'email_password' => generatePassword(),
|
'email_password' => generatePassword(),
|
||||||
'alternative_email' => 'noone@example.com'
|
'alternative_email' => 'noone@example.com',
|
||||||
|
'sendinfomail' => TRAVIS_CI == 1 ? 0 : 1
|
||||||
];
|
];
|
||||||
$json_result = EmailAccounts::getLocal($customer_userdata, $data)->add();
|
$json_result = EmailAccounts::getLocal($customer_userdata, $data)->add();
|
||||||
$result = json_decode($json_result, true)['data'];
|
$result = json_decode($json_result, true)['data'];
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class FtpsTest extends TestCase
|
|||||||
'ftp_password' => 'h4xXx0r',
|
'ftp_password' => 'h4xXx0r',
|
||||||
'path' => '/',
|
'path' => '/',
|
||||||
'ftp_description' => 'testing',
|
'ftp_description' => 'testing',
|
||||||
'sendinfomail' => 1
|
'sendinfomail' => TRAVIS_CI == 1 ? 0 : 1
|
||||||
];
|
];
|
||||||
$json_result = Ftps::getLocal($customer_userdata, $data)->add();
|
$json_result = Ftps::getLocal($customer_userdata, $data)->add();
|
||||||
$result = json_decode($json_result, true)['data'];
|
$result = json_decode($json_result, true)['data'];
|
||||||
@@ -236,7 +236,7 @@ class FtpsTest extends TestCase
|
|||||||
'ftp_password' => 'h4xXx0r',
|
'ftp_password' => 'h4xXx0r',
|
||||||
'path' => '/',
|
'path' => '/',
|
||||||
'ftp_description' => 'testing',
|
'ftp_description' => 'testing',
|
||||||
'sendinfomail' => 1
|
'sendinfomail' => TRAVIS_CI == 1 ? 0 : 1
|
||||||
];
|
];
|
||||||
$json_result = Ftps::getLocal($admin_userdata, $data)->add();
|
$json_result = Ftps::getLocal($admin_userdata, $data)->add();
|
||||||
$result = json_decode($json_result, true)['data'];
|
$result = json_decode($json_result, true)['data'];
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class MysqlsTest extends TestCase
|
|||||||
$data = [
|
$data = [
|
||||||
'mysql_password' => generatePassword(),
|
'mysql_password' => generatePassword(),
|
||||||
'description' => 'testdb',
|
'description' => 'testdb',
|
||||||
'sendinfomail' => true
|
'sendinfomail' => TRAVIS_CI == 1 ? 0 : 1
|
||||||
];
|
];
|
||||||
$json_result = Mysqls::getLocal($customer_userdata, $data)->add();
|
$json_result = Mysqls::getLocal($customer_userdata, $data)->add();
|
||||||
$result = json_decode($json_result, true)['data'];
|
$result = json_decode($json_result, true)['data'];
|
||||||
|
|||||||
@@ -4,10 +4,12 @@ if (file_exists('/etc/froxlor-test.pwd') && file_exists('/etc/froxlor-test.rpwd'
|
|||||||
// froxlor jenkins test-system
|
// froxlor jenkins test-system
|
||||||
$pwd = trim(file_get_contents('/etc/froxlor-test.pwd'));
|
$pwd = trim(file_get_contents('/etc/froxlor-test.pwd'));
|
||||||
$rpwd = trim(file_get_contents('/etc/froxlor-test.rpwd'));
|
$rpwd = trim(file_get_contents('/etc/froxlor-test.rpwd'));
|
||||||
|
define('TRAVIS_CI', 0);
|
||||||
} else {
|
} else {
|
||||||
// travis-ci.org
|
// travis-ci.org
|
||||||
$pwd = 'fr0xl0r.TravisCI';
|
$pwd = 'fr0xl0r.TravisCI';
|
||||||
$rpwd = 'fr0xl0r.TravisCI';
|
$rpwd = 'fr0xl0r.TravisCI';
|
||||||
|
define('TRAVIS_CI', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$userdata_content = "<?php
|
$userdata_content = "<?php
|
||||||
|
|||||||
Reference in New Issue
Block a user