通过API测试将电子邮件发送到localhost mailhog

时间:2018-10-05 08:17:16

标签: javascript api email docker smtp

我在docker上安装了mailhog,Web ui在localhost:8025上,smtp服务器在localhost:1025上

我还要进行API注册测试,我应该在电子邮件字段中使用哪个地址在localhost:8025接收注册邮件?我尝试了各种组合,但是邮件在mailhog收件箱中不可见。 默认主机名应为mailhog.example

或者在这里需要本地api?

    it('should register new user', async()=> {
      logger.info(randomMail);
      const res = await request
      .post('/rest/v2/auth/registration')
      .set(config.headers) 
      .set('Authorization', 'Bearer ' + auth_token)
      .send({
        "email": "mail@mailhog.com",
        "firstName" : randomFirstName,
        "lastName" : randomLastName,
        "password" : "Test123",
        "repeatPassword": "Test123",
        "phoneNo": "600000000",
        "agreements": {
          "acceptTerms":true,
          "acceptNewAgreement":true,
          "acceptDataProcessingAgreement": true,
          "acceptMarketingEmailAgreement": false,
          "acceptMarketingSmsAgreement": false
         },
         "continueUrl": "http://test.wp.pl/d-cf/"
       });
       logger.info(config.logToConsole(res.request.url,res.request._data));
       assert.equal(res.status,200);
      assert.isTrue(res.body.isSuccess);       
    })

0 个答案:

没有答案