mirror of
https://github.com/nodemailer/wildduck.git
synced 2025-01-01 05:06:44 +08:00
fixed tests
This commit is contained in:
parent
6170544751
commit
a6cba61f4f
2 changed files with 20 additions and 25 deletions
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
DBNAME="$1"
|
DBNAME="$1"
|
||||||
|
|
||||||
#echo "Clearing DB"
|
echo "Clearing DB"
|
||||||
mongo "$DBNAME" --eval "db.getCollectionNames().forEach(function(key){db[key].deleteMany({});})" > /dev/null
|
mongo "$DBNAME" --eval "db.getCollectionNames().forEach(function(key){db[key].deleteMany({});})" > /dev/null
|
||||||
|
|
||||||
#echo "Creating user"
|
echo "Creating user"
|
||||||
USERRESPONSE=`curl --silent -XPOST http://localhost:8080/users \
|
USERRESPONSE=`curl --silent -XPOST http://localhost:8080/users \
|
||||||
-H 'Content-type: application/json' \
|
-H 'Content-type: application/json' \
|
||||||
-d '{
|
-d '{
|
||||||
|
@ -13,13 +13,13 @@ USERRESPONSE=`curl --silent -XPOST http://localhost:8080/users \
|
||||||
"password": "pass",
|
"password": "pass",
|
||||||
"name": "Test User"
|
"name": "Test User"
|
||||||
}'`
|
}'`
|
||||||
#echo "UR: $USERRESPONSE"
|
echo "UR: $USERRESPONSE"
|
||||||
USERID=`echo "$USERRESPONSE" | jq -r '.id'`
|
USERID=`echo "$USERRESPONSE" | jq -r '.id'`
|
||||||
|
|
||||||
#echo "Reading Mailbox ID"
|
echo "Reading Mailbox ID"
|
||||||
MAILBOXLIST=`curl --silent "http://localhost:8080/users/$USERID/mailboxes"`
|
MAILBOXLIST=`curl --silent "http://localhost:8080/users/$USERID/mailboxes"`
|
||||||
#echo "ML: $MAILBOXLIST"
|
echo "ML: $MAILBOXLIST"
|
||||||
#echo "$MAILBOXLIST" | jq
|
echo "$MAILBOXLIST" | jq
|
||||||
INBOXID=`echo "$MAILBOXLIST" | jq -r '.results[0].id'`
|
INBOXID=`echo "$MAILBOXLIST" | jq -r '.results[0].id'`
|
||||||
SENTID=`echo "$MAILBOXLIST" | jq -r '.results[3].id'`
|
SENTID=`echo "$MAILBOXLIST" | jq -r '.results[3].id'`
|
||||||
|
|
||||||
|
@ -27,26 +27,26 @@ curl --silent -XPUT "http://localhost:8080/users/$USERID/mailboxes/$SENTID" \
|
||||||
-H 'Content-type: application/json' \
|
-H 'Content-type: application/json' \
|
||||||
-d '{
|
-d '{
|
||||||
"path": "[Gmail]/Sent Mail"
|
"path": "[Gmail]/Sent Mail"
|
||||||
}' > /dev/null
|
}'
|
||||||
|
|
||||||
MAILBOXLIST=`curl --silent "http://localhost:8080/users/$USERID/mailboxes"`
|
MAILBOXLIST=`curl --silent "http://localhost:8080/users/$USERID/mailboxes"`
|
||||||
#echo "$MAILBOXLIST" | jq
|
echo "$MAILBOXLIST" | jq
|
||||||
|
|
||||||
curl --silent -XPOST "http://localhost:8080/users/$USERID/mailboxes/$INBOXID/messages?date=14-Sep-2013%2021%3A22%3A28%20-0300&unseen=true" \
|
curl --silent -XPOST "http://localhost:8080/users/$USERID/mailboxes/$INBOXID/messages?date=14-Sep-2013%2021%3A22%3A28%20-0300&unseen=true" \
|
||||||
-H 'Content-type: message/rfc822' \
|
-H 'Content-type: message/rfc822' \
|
||||||
--data-binary "@fixtures/fix1.eml" > /dev/null
|
--data-binary "@fixtures/fix1.eml"
|
||||||
|
|
||||||
curl --silent -XPOST "http://localhost:8080/users/$USERID/mailboxes/$INBOXID/messages?unseen=false" \
|
curl --silent -XPOST "http://localhost:8080/users/$USERID/mailboxes/$INBOXID/messages?unseen=false" \
|
||||||
-H 'Content-type: message/rfc822' \
|
-H 'Content-type: message/rfc822' \
|
||||||
--data-binary "@fixtures/fix2.eml" > /dev/null
|
--data-binary "@fixtures/fix2.eml"
|
||||||
|
|
||||||
curl --silent -XPOST "http://localhost:8080/users/$USERID/mailboxes/$INBOXID/messages?unseen=false" \
|
curl --silent -XPOST "http://localhost:8080/users/$USERID/mailboxes/$INBOXID/messages?unseen=false" \
|
||||||
-H 'Content-type: message/rfc822' \
|
-H 'Content-type: message/rfc822' \
|
||||||
--data-binary "@fixtures/fix3.eml" > /dev/null
|
--data-binary "@fixtures/fix3.eml"
|
||||||
|
|
||||||
curl --silent -XPOST "http://localhost:8080/users/$USERID/mailboxes/$INBOXID/messages?unseen=true" \
|
curl --silent -XPOST "http://localhost:8080/users/$USERID/mailboxes/$INBOXID/messages?unseen=true" \
|
||||||
-H 'Content-type: message/rfc822' \
|
-H 'Content-type: message/rfc822' \
|
||||||
--data-binary "@fixtures/fix4.eml" > /dev/null
|
--data-binary "@fixtures/fix4.eml"
|
||||||
|
|
||||||
curl --silent -XPOST "http://localhost:8080/users/$USERID/mailboxes/$INBOXID/messages?unseen=true" \
|
curl --silent -XPOST "http://localhost:8080/users/$USERID/mailboxes/$INBOXID/messages?unseen=true" \
|
||||||
-H 'Content-type: message/rfc822' \
|
-H 'Content-type: message/rfc822' \
|
||||||
|
@ -55,7 +55,7 @@ to: receiver@example.com
|
||||||
subject: test5
|
subject: test5
|
||||||
|
|
||||||
hello 5
|
hello 5
|
||||||
" > /dev/null
|
"
|
||||||
|
|
||||||
curl --silent -XPOST "http://localhost:8080/users/$USERID/mailboxes/$INBOXID/messages?unseen=true" \
|
curl --silent -XPOST "http://localhost:8080/users/$USERID/mailboxes/$INBOXID/messages?unseen=true" \
|
||||||
-H 'Content-type: message/rfc822' \
|
-H 'Content-type: message/rfc822' \
|
||||||
|
@ -64,7 +64,7 @@ to: receiver@example.com
|
||||||
subject: test6
|
subject: test6
|
||||||
|
|
||||||
hello 6
|
hello 6
|
||||||
" > /dev/null
|
"
|
||||||
|
|
||||||
mongo "$DBNAME" --eval "db.mailboxes.updateOne({_id: ObjectId('$INBOXID')}, {\$set:{modifyIndex: 5000, uidNext: 1000}});
|
mongo "$DBNAME" --eval "db.mailboxes.updateOne({_id: ObjectId('$INBOXID')}, {\$set:{modifyIndex: 5000, uidNext: 1000}});
|
||||||
db.messages.updateOne({mailbox: ObjectId('$INBOXID'), uid:1}, {\$set:{modseq: 100}});
|
db.messages.updateOne({mailbox: ObjectId('$INBOXID'), uid:1}, {\$set:{modseq: 100}});
|
||||||
|
|
|
@ -18,9 +18,9 @@ describe('IMAP Protocol integration tests', function() {
|
||||||
let port = 9993;
|
let port = 9993;
|
||||||
|
|
||||||
beforeEach(function(done) {
|
beforeEach(function(done) {
|
||||||
exec(__dirname + '/prepare.sh ' + config.dbs.dbname, { cwd: __dirname }, (err, stdout, stderr) => {
|
exec(__dirname + '/prepare.sh ' + config.dbs.dbname, { cwd: __dirname }, (err /*, stdout, stderr*/) => {
|
||||||
console.log(stdout.toString());
|
// console.log(stdout.toString());
|
||||||
console.log(stderr.toString());
|
// console.log(stderr.toString());
|
||||||
if (err) {
|
if (err) {
|
||||||
return done(err);
|
return done(err);
|
||||||
}
|
}
|
||||||
|
@ -606,8 +606,7 @@ describe('IMAP Protocol integration tests', function() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.only('should append large file in chunks', function(done) {
|
it('should append large file in chunks', function(done) {
|
||||||
console.log(0);
|
|
||||||
let lchunks = [].concat(chunks);
|
let lchunks = [].concat(chunks);
|
||||||
let message = lchunks.join('');
|
let message = lchunks.join('');
|
||||||
|
|
||||||
|
@ -618,19 +617,15 @@ describe('IMAP Protocol integration tests', function() {
|
||||||
'T3 LOGOUT'
|
'T3 LOGOUT'
|
||||||
];
|
];
|
||||||
|
|
||||||
console.log(0, cmds.length);
|
|
||||||
console.log(1);
|
|
||||||
testClient(
|
testClient(
|
||||||
{
|
{
|
||||||
commands: cmds,
|
commands: cmds,
|
||||||
secure: true,
|
secure: true,
|
||||||
debug: true,
|
//debug: true,
|
||||||
port //debug: true
|
port
|
||||||
},
|
},
|
||||||
function(resp) {
|
function(resp) {
|
||||||
console.log(2);
|
|
||||||
resp = resp.toString();
|
resp = resp.toString();
|
||||||
console.log(resp);
|
|
||||||
expect(/^T2 OK/m.test(resp)).to.be.true;
|
expect(/^T2 OK/m.test(resp)).to.be.true;
|
||||||
expect(resp.indexOf('\r\n* LIST (\\HasNoChildren) "/" "testfolder"\r\n') >= 0).to.be.false;
|
expect(resp.indexOf('\r\n* LIST (\\HasNoChildren) "/" "testfolder"\r\n') >= 0).to.be.false;
|
||||||
expect(/^[^\s]+ BAD/m.test(resp)).to.be.false;
|
expect(/^[^\s]+ BAD/m.test(resp)).to.be.false;
|
||||||
|
|
Loading…
Reference in a new issue