Merge pull request #294 from AttorneyOnline/unittest-ConfigManager
[WIP] Unit test ConfigManager
This commit is contained in:
commit
035ebd1a9f
15
bin_tests/config/areas.ini
Normal file
15
bin_tests/config/areas.ini
Normal file
@ -0,0 +1,15 @@
|
||||
[0:Basement]
|
||||
background=gs4
|
||||
protected_area=true
|
||||
iniswap_allowed=false
|
||||
evidence_mod=cm
|
||||
blankposting_allowed=true
|
||||
force_immediate=true
|
||||
|
||||
[1:Courtroom 1]
|
||||
background=gs4
|
||||
protected_area=false
|
||||
iniswap_allowed=true
|
||||
evidence_mod=ffa
|
||||
blankposting_allowed=true
|
||||
force_immediate=false
|
5
bin_tests/config/backgrounds.txt
Normal file
5
bin_tests/config/backgrounds.txt
Normal file
@ -0,0 +1,5 @@
|
||||
Anime
|
||||
Zetta
|
||||
default
|
||||
birthday
|
||||
Christmas
|
5
bin_tests/config/characters.txt
Normal file
5
bin_tests/config/characters.txt
Normal file
@ -0,0 +1,5 @@
|
||||
Zak
|
||||
Adrian
|
||||
Armstrong
|
||||
Butz
|
||||
Diego
|
89
bin_tests/config/command_extensions.ini
Normal file
89
bin_tests/config/command_extensions.ini
Normal file
@ -0,0 +1,89 @@
|
||||
[getarea]
|
||||
aliases = ga
|
||||
|
||||
[getareas]
|
||||
aliases = gas
|
||||
|
||||
[area_lock]
|
||||
aliases = lock_area lock
|
||||
|
||||
[area_spectate]
|
||||
aliases = spectatable
|
||||
|
||||
[area_unlock]
|
||||
aliases = unlock_area unlock
|
||||
|
||||
[area_kick]
|
||||
aliases = kick_area areakick
|
||||
|
||||
[background]
|
||||
aliases = bg
|
||||
|
||||
[lock_background]
|
||||
aliases = lock_bg lockbg bglock
|
||||
|
||||
[unlock_background]
|
||||
aliases = unlock_bg unlockbg bgunlock
|
||||
|
||||
[roll]
|
||||
aliases = r
|
||||
|
||||
[set_motd]
|
||||
aliases = setmotd
|
||||
|
||||
[force_charselect]
|
||||
aliases = forcecharselect
|
||||
|
||||
[notecard_reveal]
|
||||
aliases = reveal_notecard notecardreveal
|
||||
|
||||
[notecard_clear]
|
||||
aliases = clear_notecard notecardclear
|
||||
|
||||
[allow_blankposting]
|
||||
aliases = allowblankposting
|
||||
|
||||
[force_noint_pres]
|
||||
aliases = forceimmediate
|
||||
|
||||
[allow_iniswap]
|
||||
aliases = allowiniswap
|
||||
|
||||
[ooc_mute]
|
||||
aliases = mute_ooc oocmute
|
||||
|
||||
[ooc_unmute]
|
||||
aliases = unmute_ooc oocunmute
|
||||
|
||||
[block_wtce]
|
||||
aliases = blockwtce
|
||||
|
||||
[unblock_wtce]
|
||||
aliases = unblockwtce
|
||||
|
||||
[block_dj]
|
||||
aliases = blockdj
|
||||
|
||||
[unblock_dj]
|
||||
aliases = unblockdj
|
||||
|
||||
[kick_uid]
|
||||
aliases = kickuid
|
||||
|
||||
[update_ban]
|
||||
aliases = updateban
|
||||
|
||||
[ignore_bglist]
|
||||
aliases = ignorebglist
|
||||
|
||||
[toggle_wtce]
|
||||
aliases = togglewtce
|
||||
|
||||
[toggle_shouts]
|
||||
aliases = toggleshouts
|
||||
|
||||
[kick_other]
|
||||
aliases = kickother
|
||||
|
||||
[jukebox_skip]
|
||||
aliases = jukeboxskip
|
106
bin_tests/config/config.ini
Normal file
106
bin_tests/config/config.ini
Normal file
@ -0,0 +1,106 @@
|
||||
[Options]
|
||||
; The maximum number of players that can join the server at once.
|
||||
max_players=100
|
||||
|
||||
; The TCP port to listen for incoming connections on.
|
||||
port=27016
|
||||
|
||||
; The server description that will appear on the master server.
|
||||
server_description=This is a placeholder server description. Tell the world of AO who you are here!
|
||||
|
||||
; The server's name. This appears both on the master server, and in messages sent to users by the server.
|
||||
server_name=An Unnamed Server
|
||||
|
||||
; The server's Message of the Day. This will be sent in OOC to joining users.
|
||||
motd=MOTD is not set.
|
||||
|
||||
; Whether the server should accept WebAO connections or not.
|
||||
webao_enable=true
|
||||
|
||||
; The TCP port to listen for WebAO connections on. This must be different than the server port.
|
||||
webao_port=27017
|
||||
|
||||
; The authorization level of the server. You shouldn't touch this, use /changeauth on the server instead.
|
||||
auth=simple
|
||||
|
||||
; The moderator password used with simple authorization. Change this to something unique and secure.
|
||||
modpass=changeme
|
||||
|
||||
; The amount of logged messages an area should store. Once this limit is reached, older messages will be overrwritten.
|
||||
; This is only used for modcall logging, or if the webhook_sendfile is enabled.
|
||||
logbuffer=500
|
||||
|
||||
; The server logging type. Valid values here are "modcall","full" and "fullarea".
|
||||
; Modcall logging will only save an area log file if a modcall is sent.
|
||||
; Full logging will log every event in every area, and will output to a new file every day.
|
||||
; FullArea logging will log every event in every area, seperating them into individual files and output to a new one every day.
|
||||
logging=modcall
|
||||
|
||||
; The maximum number of statements that can be recorded in the testimony recorder.
|
||||
maximum_statements=10
|
||||
|
||||
; The maximum number of connections that will be accepted from the same IP address.
|
||||
; Multiclienting is generally used for casing/RPing, so the default value is fine in most cases.
|
||||
multiclient_limit=15
|
||||
|
||||
; The maximum number of characters that an IC/OOC message can contain.
|
||||
maximum_characters=256
|
||||
|
||||
; The minimum time between game messages in areas, in miliseconds. The default value is fine for most cases.
|
||||
message_floodguard=250
|
||||
|
||||
; The minimum time between game messages in the server, in miliseconds. Unlike message_floodguard, this timer is shared globally in the server.
|
||||
global_message_floodguard=0
|
||||
|
||||
; The amount of seconds without interaction till a client is marked as AFK.
|
||||
afk_timeout = 300
|
||||
|
||||
; The URL of the server's remote repository, sent to the client during their initial handshake. Used by WebAO users for custom content.
|
||||
asset_url=http://attorneyoffline.de/base/
|
||||
|
||||
[Advertiser]
|
||||
; Options for the Masterserver.
|
||||
|
||||
; Whether or not the server should appear on the master server.
|
||||
advertise=true
|
||||
|
||||
; Wether the advertiser prints additional debug info
|
||||
debug=false
|
||||
|
||||
; The IP address of the master server. Unless something happens to the default one, you shouldn't change this.
|
||||
ms_ip=https://servers.aceattorneyonline.com/servers
|
||||
|
||||
; Optional hostname of your server. Can either be an IP or a DNS name. Disables automatic IP detection of ms3.
|
||||
hostname=
|
||||
|
||||
; Wether or not the server overwrites the advertised webao port to port 80 in order to utilise Cloudflare tunnels.
|
||||
cloudflare_enabled=false
|
||||
|
||||
[Dice]
|
||||
; The maximum number of sides dice can be rolled with.
|
||||
max_value=100
|
||||
|
||||
; The maximum number of dice that can be rolled at once.
|
||||
max_dice=100
|
||||
|
||||
[Password]
|
||||
; Whether or not to enforce password requirements. Only applicable under advanced authorization.
|
||||
password_requirements = true
|
||||
|
||||
; The minimum length passwords must be.
|
||||
pass_min_length = 8
|
||||
|
||||
; The maximum length passwords can be. Set to 0 for unlimited length passwords.
|
||||
pass_max_length = 0
|
||||
|
||||
; Whether passwords must contain both uppercase and lowercase letters.
|
||||
pass_required_mix_case = true
|
||||
|
||||
; Whether passwords must contain at least one number.
|
||||
pass_required_numbers = true
|
||||
|
||||
; Whether passwords must contain at least one special character.
|
||||
pass_required_special = true
|
||||
|
||||
; Whether passwords can contain the username inside them.
|
||||
pass_can_contain_username = false
|
33
bin_tests/config/discord.ini
Normal file
33
bin_tests/config/discord.ini
Normal file
@ -0,0 +1,33 @@
|
||||
[Discord]
|
||||
; Enables the Discord Webhook Integration
|
||||
webhook_enabled=false
|
||||
|
||||
; Enables the modcall webhook to post a message when a modcall is made.
|
||||
webhook_modcall_enabled=false
|
||||
|
||||
; The URL of the modcall webhook. Must contain the webhook ID and token.
|
||||
webhook_modcall_url=
|
||||
|
||||
; Optional text. Usually for adding tags for roles. Ensure the format is <@&[RoleID]>.
|
||||
webhook_modcall_content=
|
||||
|
||||
; Attaches a logfile of the area to the modcall webhook.
|
||||
webhook_modcall_sendfile=false
|
||||
|
||||
; Enables the ban webhook.
|
||||
webhook_ban_enabled = false
|
||||
|
||||
; The URL of the ban discord webhook to send messages to. Must contain the webhook ID and token.
|
||||
webhook_ban_url=
|
||||
|
||||
; Enables Uptime Webhook.
|
||||
webhook_uptime_enabled = false
|
||||
|
||||
; The time between message posting. Time is in minutes.
|
||||
webhook_uptime_time = 60
|
||||
|
||||
; The URL of the Uptime Webhook. Must contain the webhook ID and token.
|
||||
webhook_uptime_url=
|
||||
|
||||
; The color code for the webhook. Allows customization of the color used in the embeed.
|
||||
webhook_color=
|
10
bin_tests/config/iprange_bans.txt
Normal file
10
bin_tests/config/iprange_bans.txt
Normal file
@ -0,0 +1,10 @@
|
||||
# Test nets
|
||||
192.0.2.0/24
|
||||
198.51.100.0/24
|
||||
192.88.99.0/24
|
||||
203.0.113.0/24
|
||||
|
||||
# IPv6
|
||||
2001:0000:/32
|
||||
2001:db8::/32
|
||||
2002::/16
|
20
bin_tests/config/music.json
Normal file
20
bin_tests/config/music.json
Normal file
@ -0,0 +1,20 @@
|
||||
[
|
||||
{
|
||||
"category":"==Samplelist==",
|
||||
"songs":[
|
||||
{
|
||||
"name":"Announce The Truth (AA).opus",
|
||||
"length":79.5
|
||||
},
|
||||
{
|
||||
"name":"Announce The Truth (AJ).opus",
|
||||
"length":59.5
|
||||
},
|
||||
{
|
||||
"name":"Announce The Truth (JFA).opus",
|
||||
"realname":"https://localhost/Announce The Truth (JFA).opus",
|
||||
"length":98
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
20
bin_tests/config/text/8ball.txt
Normal file
20
bin_tests/config/text/8ball.txt
Normal file
@ -0,0 +1,20 @@
|
||||
It is certain.
|
||||
It is decidedly so.
|
||||
Without a doubt.
|
||||
Yes - definitely.
|
||||
You may rely on it.
|
||||
As I see it, yes.
|
||||
Most likely.
|
||||
Outlook good.
|
||||
Yes.
|
||||
Signs point to yes.
|
||||
Reply hazy, try again.
|
||||
Ask again later.
|
||||
Better not tell you now.
|
||||
Cannot predict now.
|
||||
Concentrate and ask again.
|
||||
Don't count on it.
|
||||
My reply is no.
|
||||
My sources say no.
|
||||
Outlook not so good.
|
||||
Very doubtful.
|
1
bin_tests/config/text/cdns.txt
Normal file
1
bin_tests/config/text/cdns.txt
Normal file
@ -0,0 +1 @@
|
||||
cdn.discord.com
|
22
bin_tests/config/text/commandhelp.json
Normal file
22
bin_tests/config/text/commandhelp.json
Normal file
@ -0,0 +1,22 @@
|
||||
[
|
||||
{
|
||||
"name":"foo",
|
||||
"usage":"/foo <bar> [baz|qux]",
|
||||
"text":"A sample explanation."
|
||||
},
|
||||
{
|
||||
"name":"login",
|
||||
"usage":"/login",
|
||||
"text":"Activates the login dialogue to enter your credentials. This command takes no arguments."
|
||||
},
|
||||
{
|
||||
"name":"getareas",
|
||||
"usage":"/getareas",
|
||||
"text":"Lists all clients in all areas. This command takes no arguments."
|
||||
},
|
||||
{
|
||||
"name":"getarea",
|
||||
"usage":"/getarea",
|
||||
"text":"Lists all clients in the area the caller is in. This command takes no arguments."
|
||||
}
|
||||
]
|
11
bin_tests/config/text/gimp.txt
Normal file
11
bin_tests/config/text/gimp.txt
Normal file
@ -0,0 +1,11 @@
|
||||
I love the mods on this server!
|
||||
At 3:03 PM maya went into my house and ate my corn bread
|
||||
Enlargement
|
||||
Do you think I am imcompetent?
|
||||
WE CAN'T TRUST ANY OF THE WITNESSES THROW THEM ALL OUT
|
||||
I'm not a clown, I'm the entire circus.
|
||||
What if the murder, it was not a murder?
|
||||
omti
|
||||
<3
|
||||
what's an akashi
|
||||
*punches bailiff*
|
81
bin_tests/config/text/logtext.ini
Normal file
81
bin_tests/config/text/logtext.ini
Normal file
@ -0,0 +1,81 @@
|
||||
[LogConfiguration]
|
||||
; This file controls how the log entires look. Editing these can cause logs to become nonfunctional, so be careful.
|
||||
; Each logtype will mention what data is available and what their formatter is.
|
||||
|
||||
; %1 = Event Time
|
||||
; %2 = Character Name
|
||||
; %3 = Out-Of-Courtroom Name
|
||||
; %4 = Client IPID
|
||||
; %5 = Area Name
|
||||
; %6 = Message
|
||||
ic="[%1][%5][IC][%2(%3)][%4]%6"
|
||||
|
||||
; %1 = Event Time
|
||||
; %2 = Character Name
|
||||
; %3 = Out-Of-Courtroom Name
|
||||
; %4 = Client IPID
|
||||
; %5 = Area Name
|
||||
; %6 = Message
|
||||
ooc="[%1][%5][OOC][%2(%3)][%4]%6"
|
||||
|
||||
; %1 = Event Time
|
||||
; %2 = Success/Fail
|
||||
; %3 = Client IPID
|
||||
; %4 = Character Name
|
||||
; %5 = Out-Of-Courtroom Name
|
||||
login="[%1][LOGIN][%2][%3][%4(%5)]"
|
||||
|
||||
; %1 = Event Time
|
||||
; %2 = Area Name
|
||||
; %3 = Character Name
|
||||
; %4 = Out-Of-Courtroom Name
|
||||
; %5 = Client IPID
|
||||
cmdlogin="[%1][%2][LOGIN][%5][%3(%4)]"
|
||||
|
||||
; %1 = Event Time
|
||||
; %2 = Area Name
|
||||
; %3 = Character Name
|
||||
; %4 = Out-Of-Courtroom Name
|
||||
; %5 = Client IPID
|
||||
cmdrootpass="[%1][%2][ROOTPASS][%5][%3(%4)]"
|
||||
|
||||
; %1 = Event Time
|
||||
; %2 = Area Name
|
||||
; %3 = Character Name
|
||||
; %4 = Out-Of-Courtroom Name
|
||||
; %5 = Username
|
||||
; %6 = Client IPID
|
||||
cmdadduser="[%1][%2][USERADD][%6][%3(%4)]%5"
|
||||
|
||||
; %1 = Event Time
|
||||
; %2 = Area Name
|
||||
; %3 = Character Name
|
||||
; %4 = Out-Of-Courtroom Name
|
||||
; %5 = Command Name
|
||||
; %6 = Command Arguments
|
||||
; %7 = Client IPID
|
||||
cmd="[%1][%2][CMD][%7][%3(%4)]/%5 %6"
|
||||
|
||||
; %1 = Event Time
|
||||
; %2 = Moderator Name
|
||||
; %3 = Kicked Client IPID
|
||||
kick="[%1][%2][KICK][%3]"
|
||||
|
||||
; %1 = Event Time
|
||||
; %2 = Moderator name
|
||||
; %3 = Banned Client IPID
|
||||
; %4 = Ban Duration
|
||||
ban="[%1][%2][BAN][%3][%4]"
|
||||
|
||||
; %1 = Event Time
|
||||
; %2 = Area Name
|
||||
; %3 = Character Name
|
||||
; %4 = Out-Of-Courtroom Name
|
||||
; %5 = Client IPID
|
||||
modcall="[%1][%2][MODCALL][%5][%3(%4)]"
|
||||
|
||||
; %1 = Event Time
|
||||
; %2 = IP Address
|
||||
; %3 = Client IPID
|
||||
; %4 = Client HWID
|
||||
connect="[%1][CONNECT][%2][%3][%4]"
|
10
bin_tests/config/text/praise.txt
Normal file
10
bin_tests/config/text/praise.txt
Normal file
@ -0,0 +1,10 @@
|
||||
:3
|
||||
\o/
|
||||
Be safe!
|
||||
Have fun!
|
||||
Be careful!
|
||||
Have a nice day!
|
||||
Be responsible!
|
||||
Be good!
|
||||
I believe in you!
|
||||
|
11
bin_tests/config/text/reprimands.txt
Normal file
11
bin_tests/config/text/reprimands.txt
Normal file
@ -0,0 +1,11 @@
|
||||
>:(
|
||||
;w;
|
||||
I should have you held in contempt.
|
||||
You should be ashamed of yourself.
|
||||
Tsk, tsk.
|
||||
What did you do this time?
|
||||
You're better than this.
|
||||
*sigh*
|
||||
Didn't anyone ever teach you manners?
|
||||
Really?
|
||||
Shameful.
|
@ -95,7 +95,7 @@ class ConfigManager
|
||||
static void loadCommandHelp();
|
||||
|
||||
/**
|
||||
* @brief Returns the content of
|
||||
* @brief Returns a pointer to the QSettings object which contains the area configuration.
|
||||
*
|
||||
* @return See short description.
|
||||
*/
|
||||
|
@ -6,4 +6,5 @@ SUBDIRS += \
|
||||
unittest_acl_roles_handler \
|
||||
unittest_command_extension \
|
||||
unittest_aopacket \
|
||||
unittest_config_manager \
|
||||
unittest_crypto
|
433
tests/unittest_config_manager/tst_unittest_config_manager.cpp
Normal file
433
tests/unittest_config_manager/tst_unittest_config_manager.cpp
Normal file
@ -0,0 +1,433 @@
|
||||
#include <QString>
|
||||
#include <QTest>
|
||||
|
||||
#include <include/config_manager.h>
|
||||
|
||||
namespace tests {
|
||||
namespace unittests {
|
||||
|
||||
class tst_ConfigManager : public QObject
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
typedef QMap<QString, QPair<QString, int>> MusicList;
|
||||
|
||||
private slots:
|
||||
|
||||
/**
|
||||
* @brief Tests if the config folder is complete. Fails when a config file is missing.
|
||||
*/
|
||||
void verifyServerConfig();
|
||||
|
||||
/**
|
||||
* @brief Retrieves the IPs the servers binds to in string format
|
||||
*/
|
||||
void bindIP();
|
||||
|
||||
void charlist();
|
||||
|
||||
void backgrounds();
|
||||
|
||||
void musiclist();
|
||||
|
||||
void ordered_songs();
|
||||
|
||||
void CommandInfo();
|
||||
|
||||
void iprangeBans();
|
||||
|
||||
void maxPlayers();
|
||||
|
||||
void serverPort();
|
||||
|
||||
void serverDescription();
|
||||
|
||||
void serverName();
|
||||
|
||||
void motd();
|
||||
|
||||
void webaoEnabled();
|
||||
|
||||
void webaoPort();
|
||||
|
||||
void authType();
|
||||
|
||||
void modpass();
|
||||
|
||||
void logBuffer();
|
||||
|
||||
void loggingType();
|
||||
|
||||
void maxStatements();
|
||||
|
||||
void multiClientLimit();
|
||||
|
||||
void maxCharacters();
|
||||
|
||||
void messageFloodguard();
|
||||
|
||||
void globalMessageFloodguard();
|
||||
|
||||
void assetUrl();
|
||||
|
||||
void diceMaxValue();
|
||||
|
||||
void diceMaxDice();
|
||||
|
||||
void discordWebhookEnabled();
|
||||
|
||||
void discordModcallWebhookEnabled();
|
||||
|
||||
void discordModcallWebhookUrl();
|
||||
|
||||
void discordModcallWebhookContent();
|
||||
|
||||
void discordModcallWebhookSendFile();
|
||||
|
||||
void discordBanWebhookEnabled();
|
||||
|
||||
void discordBanWebhookUrl();
|
||||
|
||||
void discordUptimeEnabled();
|
||||
|
||||
void discordUptimeTime();
|
||||
|
||||
void discordUptimeWebhookUrl();
|
||||
|
||||
void discordWebhookColor();
|
||||
|
||||
void passwordRequirements();
|
||||
|
||||
void passwordMinLength();
|
||||
|
||||
void passwordMaxLength();
|
||||
|
||||
void passwordRequireMixCase();
|
||||
|
||||
void passwordRequireNumbers();
|
||||
|
||||
void passwordRequireSpecialCharacters();
|
||||
|
||||
void passwordCanContainUsername();
|
||||
|
||||
void afkTimeout();
|
||||
|
||||
void magic8BallAnswers();
|
||||
|
||||
void praiseList();
|
||||
|
||||
void reprimandsList();
|
||||
|
||||
void gimpList();
|
||||
|
||||
void cdnList();
|
||||
|
||||
void advertiseServer();
|
||||
|
||||
void advertiserDebug();
|
||||
|
||||
void advertiserIP();
|
||||
|
||||
void advertiserHostname();
|
||||
|
||||
void advertiserCloudflareMode();
|
||||
};
|
||||
|
||||
void tst_ConfigManager::verifyServerConfig()
|
||||
{
|
||||
// If the sample folder is not renamed or a file is missing, we fail the test.
|
||||
QCOMPARE(ConfigManager::verifyServerConfig(), true);
|
||||
|
||||
// We remove a config file and test again. This should now fail as cdns.txt is missing.
|
||||
QCOMPARE(QFile("config/text/cdns.txt").remove(), true);
|
||||
QCOMPARE(ConfigManager::verifyServerConfig(), false);
|
||||
|
||||
// We rebuild the file.
|
||||
QFile cdns_config("config/text/cdns.txt");
|
||||
if (cdns_config.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) {
|
||||
QTextStream write_stream(&cdns_config);
|
||||
write_stream << "cdn.discord.com";
|
||||
cdns_config.close();
|
||||
}
|
||||
else {
|
||||
qDebug() << "Unable to recreate cdns config file.";
|
||||
}
|
||||
}
|
||||
|
||||
void tst_ConfigManager::bindIP()
|
||||
{
|
||||
QCOMPARE(ConfigManager::bindIP(), "all");
|
||||
}
|
||||
|
||||
void tst_ConfigManager::charlist()
|
||||
{
|
||||
// We check that the list is unsorted and exactly as defined in the text file.
|
||||
QStringList l_characters = ConfigManager::charlist();
|
||||
QCOMPARE(l_characters.at(0), "Zak");
|
||||
QCOMPARE(l_characters.at(1), "Adrian");
|
||||
QCOMPARE(l_characters.at(2), "Armstrong");
|
||||
QCOMPARE(l_characters.at(3), "Butz");
|
||||
QCOMPARE(l_characters.at(4), "Diego");
|
||||
}
|
||||
|
||||
void tst_ConfigManager::backgrounds()
|
||||
{
|
||||
// We check that the list is unsorted and exactly as defined in the text file.
|
||||
QStringList l_backgrounds = ConfigManager::backgrounds();
|
||||
|
||||
QCOMPARE(l_backgrounds.at(0), "Anime");
|
||||
QCOMPARE(l_backgrounds.at(1), "Zetta");
|
||||
QCOMPARE(l_backgrounds.at(2), "default");
|
||||
QCOMPARE(l_backgrounds.at(3), "birthday");
|
||||
QCOMPARE(l_backgrounds.at(4), "Christmas");
|
||||
}
|
||||
|
||||
void tst_ConfigManager::musiclist()
|
||||
{
|
||||
MusicList l_musiclist = ConfigManager::musiclist();
|
||||
qDebug() << l_musiclist;
|
||||
QPair<QString, int> l_contents;
|
||||
// The musiclist is structured as {DisplayName , {Songname, Duration}}.
|
||||
|
||||
// Categories have no duration and their alias is always the category name.
|
||||
l_contents = l_musiclist.value("==Samplelist==");
|
||||
QCOMPARE(l_contents.first, "==Samplelist==");
|
||||
QCOMPARE(l_contents.second, 0);
|
||||
|
||||
// The displayname is shown in the musiclist. The realname is what is send to the client when it wants to play the song.
|
||||
l_contents = l_musiclist.value("Announce The Truth (JFA).opus");
|
||||
QCOMPARE(l_contents.first, "https://localhost/Announce The Truth (JFA).opus");
|
||||
QCOMPARE(l_contents.second, 98);
|
||||
}
|
||||
|
||||
void tst_ConfigManager::ordered_songs()
|
||||
{
|
||||
QStringList l_ordered_musiclist = ConfigManager::ordered_songs();
|
||||
QCOMPARE(l_ordered_musiclist.at(0), "==Samplelist==");
|
||||
QCOMPARE(l_ordered_musiclist.at(1), "Announce The Truth (AA).opus");
|
||||
QCOMPARE(l_ordered_musiclist.at(2), "Announce The Truth (AJ).opus");
|
||||
QCOMPARE(l_ordered_musiclist.at(3), "Announce The Truth (JFA).opus");
|
||||
}
|
||||
|
||||
void tst_ConfigManager::CommandInfo()
|
||||
{
|
||||
// Prepare command help cache.
|
||||
ConfigManager::loadCommandHelp();
|
||||
ConfigManager::help l_help;
|
||||
|
||||
// Load the sample command information.
|
||||
l_help = ConfigManager::commandHelp("foo");
|
||||
QCOMPARE(l_help.text, "A sample explanation.");
|
||||
QCOMPARE(l_help.usage, "/foo <bar> [baz|qux]");
|
||||
|
||||
l_help = ConfigManager::commandHelp("login");
|
||||
QCOMPARE(l_help.text, "Activates the login dialogue to enter your credentials. This command takes no arguments.");
|
||||
QCOMPARE(l_help.usage, "/login");
|
||||
}
|
||||
|
||||
void tst_ConfigManager::iprangeBans()
|
||||
{
|
||||
QStringList l_ipranges = ConfigManager::iprangeBans();
|
||||
QCOMPARE(l_ipranges.at(0), "# Test nets");
|
||||
QCOMPARE(l_ipranges.at(1), "192.0.2.0/24");
|
||||
}
|
||||
|
||||
void tst_ConfigManager::maxPlayers()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::serverPort()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::serverDescription()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::serverName()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::motd()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::webaoEnabled()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::webaoPort()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::authType()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::modpass()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::logBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::loggingType()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::maxStatements()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::multiClientLimit()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::maxCharacters()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::messageFloodguard()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::globalMessageFloodguard()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::assetUrl()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::diceMaxValue()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::diceMaxDice()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::discordWebhookEnabled()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::discordModcallWebhookEnabled()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::discordModcallWebhookUrl()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::discordModcallWebhookContent()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::discordModcallWebhookSendFile()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::discordBanWebhookEnabled()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::discordBanWebhookUrl()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::discordUptimeEnabled()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::discordUptimeTime()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::discordUptimeWebhookUrl()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::discordWebhookColor()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::passwordRequirements()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::passwordMinLength()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::passwordMaxLength()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::passwordRequireMixCase()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::passwordRequireNumbers()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::passwordRequireSpecialCharacters()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::passwordCanContainUsername()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::afkTimeout()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::magic8BallAnswers()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::praiseList()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::reprimandsList()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::gimpList()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::cdnList()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::advertiseServer()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::advertiserDebug()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::advertiserIP()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::advertiserHostname()
|
||||
{
|
||||
}
|
||||
|
||||
void tst_ConfigManager::advertiserCloudflareMode()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
QTEST_APPLESS_MAIN(tests::unittests::tst_ConfigManager)
|
||||
|
||||
#include "tst_unittest_config_manager.moc"
|
@ -0,0 +1,5 @@
|
||||
QT -= gui
|
||||
|
||||
include(../tests_common.pri)
|
||||
|
||||
SOURCES += tst_unittest_config_manager.cpp
|
Loading…
Reference in New Issue
Block a user