pamaxie / --OLD--Pamaxie

Worker "clients" for analyzing media content. Pamaxie is a Natural Learning API for accessing several Neural Networks and hand-crafted algorithms for moderating content on platforms.
https://pamaxie.com
Apache License 2.0
2 stars 2 forks source link

Test Configuration for CI #54

Closed PKoldborg closed 3 years ago

PKoldborg commented 3 years ago

We need to change our way of approaching the configuration inside testing classes. Currently we rely on appsettings.test.json, but that will fail when run by the CI.

A approach we can do, is to fill up a json string and put it into the Configuration property through code.

Currently the appsettings.test.json looks like this:

{
    "AuthData": {
        "Secret": "",
        "ExpiresInMinutes": 15
    },
    "ApiData": {
        "Instance": ""
    },
    "RedisData": {
        "ConnectionString": ""
    },
    "UserData": {
        "EmailAddress": ""
    },
    "EmailSender": {
        "EmailAddress": "",
        "Password": ""
    },
    "JwtToken": {
        "Secret": ""
    }
}

The secret in AuthData can be auto generated in the TestBase constructor. ApiData instance and RedisData can be empty.

We need a way to have the option to test the EmailSender, but don't test it when running the CI, so just let it pass if the CI is running without actually running the EmailSender. UserData, EmailSender are used for the EmailSender so can be empty, but with the option to be filled.

JwtToken is used to encode/decode the email confirmation link currently, this will just be filled like the Secret in AuthData, and removed once the website have been reworked a bit.

PKoldborg commented 3 years ago

This issue is completed in 1caa94 EmailSenderTest have three const variables used for testing the method. These will be set whenever a person wants to test the EmailSender, else it will just succeed if data is not provided.