MCPcopy Create free account
hub / github.com/cutelyst/cutelyst / initTestCase

Method initTestCase

tests/testserver.cpp:71–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void TestServer::initTestCase()
72{
73 QVERIFY(m_tmpDir.isValid());
74
75 // load this from the server/ini value in file1.ini
76 const QString file3Ini = m_tmpDir.filePath(u"file3.ini"_s);
77 writeIniFile(file3Ini,
78 {{u"Testsection1"_s, {{u"john"_s, u"doe"_s}}},
79 {u"Testsection3"_s, {{u"hello"_s, u"world"_s}}}});
80
81 const QString file1Ini = m_tmpDir.filePath(u"file1.ini"_s);
82 writeIniFile(file1Ini,
83 {{u"Cutelyst"_s, {{u"hello"_s, u"world1"_s}, {u"onlyin1"_s, u"hello"_s}}},
84 {u"Testsection1"_s, {{u"foo"_s, u"bar"_s}, {u"hello"_s, u"world"_s}}},
85 {u"server"_s, {{u"ini"_s, file3Ini}}}});
86
87 const QString file2Ini = m_tmpDir.filePath(u"file2.ini"_s);
88 writeIniFile(file2Ini,
89 {{u"Cutelyst"_s, {{u"hello"_s, u"world2"_s}, {u"onlyin2"_s, u"world"_s}}},
90 {u"Testsection2"_s, {{u"fu"_s, u"baz"_s}, {u"hello"_s, u"world"_s}}}});
91
92 m_expectedIniConfig = {
93 {u"Cutelyst"_s,
94 QVariantMap{
95 {u"hello"_s, u"world2"_s}, {u"onlyin1"_s, u"hello"_s}, {u"onlyin2"_s, u"world"_s}}},
96 {u"Testsection1"_s,
97 QVariantMap{{u"foo"_s, u"bar"_s}, {u"hello"_s, u"world"_s}, {u"john"_s, u"doe"_s}}},
98 {u"Testsection2"_s, QVariantMap{{u"fu"_s, u"baz"_s}, {u"hello"_s, u"world"_s}}},
99 {u"Testsection3"_s, QVariantMap{{u"hello"_s, u"world"_s}}},
100 {u"server"_s, QVariantMap{{u"ini"_s, file3Ini}}}};
101
102 // load this from the server/json value in file1.json
103 const QString file3Json = m_tmpDir.filePath(u"file3.json"_s);
104 writeJsonFile(file3Json,
105 QJsonObject{{u"Testsection1"_s, QJsonObject{{u"john"_s, u"doe"_s}}},
106 {u"Testsection3"_s, QJsonObject{{u"hello"_s, u"world"_s}}}});
107
108 const QString file1Json = m_tmpDir.filePath(u"file1.json"_s);
109 writeJsonFile(
110 file1Json,
111 QJsonObject{
112 {{u"Cutelyst"_s, QJsonObject{{u"hello"_s, u"world1"_s}, {u"onlyin1"_s, u"hello"_s}}},
113 {u"Testsection1"_s, QJsonObject{{u"foo"_s, u"bar"_s}, {u"hello"_s, u"world"_s}}},
114 {u"server"_s, QJsonObject{{u"json"_s, file3Json}}}}});
115
116 const QString file2Json = m_tmpDir.filePath(u"file2.json"_s);
117 writeJsonFile(
118 file2Json,
119 QJsonObject{
120 {{u"Cutelyst"_s, QJsonObject{{u"hello"_s, u"world2"_s}, {u"onlyin2"_s, u"world"_s}}},
121 {u"Testsection2"_s, QJsonObject{{u"fu"_s, u"baz"_s}, {u"hello"_s, u"world"_s}}}}});
122
123 m_expectedJsonConfig = {
124 {u"Cutelyst"_s,
125 QVariantMap{
126 {u"hello"_s, u"world2"_s}, {u"onlyin1"_s, u"hello"_s}, {u"onlyin2"_s, u"world"_s}}},
127 {u"Testsection1"_s,
128 QVariantMap{{u"foo"_s, u"bar"_s}, {u"hello"_s, u"world"_s}, {u"john"_s, u"doe"_s}}},

Callers

nothing calls this directly

Calls 1

isValidMethod · 0.45

Tested by

no test coverage detected