Commit ace62d5632e5b37540f5188cc4a3f91694138e33
1 parent
a715c30a
Exists in
master
Ordem de teste modificado para pegar chave de criptografia automaticamente
Showing
2 changed files
with
22 additions
and
22 deletions
Show diff stats
cacic-teste/testcacic.cpp
... | ... | @@ -79,21 +79,6 @@ void CTestCacic::testDeleteFolder() |
79 | 79 | QVERIFY(!folder.exists()); |
80 | 80 | } |
81 | 81 | |
82 | -void CTestCacic::testEnCrypt(){ | |
83 | - std::string key = "qwertyuiopasdfghjklzxcvbnmqwerty"; //chave de 256 bits (32 caracteres) | |
84 | - std::string IV = "0123456789123456"; //iv nunca se repete para a mesma senha. | |
85 | - std::string input = "aqui vai a url que sera encriptada"; | |
86 | - QVERIFY(OCacic.enCrypt(input, key, IV) == "Va2WiUrdTVrn93tCrtx0njjU4HDpn7VFCsCVr/+YgaBCVQ=="); | |
87 | -} | |
88 | - | |
89 | -void CTestCacic::testDeCrypt(){ | |
90 | - std::string key = "qwertyuiopasdfghjklzxcvbnmqwerty"; //chave de 256 bits (32 caracteres) | |
91 | - std::string IV = "0123456789123456asas"; //iv nunca se repete para a mesma senha. | |
92 | - std::string input = "Va2WiUrdTVrn93tCrtx0njjU4HDpn7VFCsCVr/+YgaBCVQ=="; | |
93 | - QVERIFY(OCacic.deCrypt(input, key, IV) == "aqui vai a url que sera encriptada"); | |
94 | - | |
95 | -} | |
96 | - | |
97 | 82 | void CTestCacic::testInterfaceDeRede(){ |
98 | 83 | // qDebug() << OCacicComp.getNetworkInterface().at(0)["nome"].toString(); |
99 | 84 | QVERIFY2(!OCacicComp.getNetworkInterface().empty(), "Nenhuma interface de rede encontrada."); |
... | ... | @@ -107,10 +92,15 @@ void CTestCacic::testPegarUsu(){ |
107 | 92 | QVERIFY(OCacicComp.getUser() != "0"); |
108 | 93 | } |
109 | 94 | |
95 | +void CTestCacic::testJsonValueFromJsonString() | |
96 | +{ | |
97 | + QVERIFY(OCacic.jsonValueFromJsonString("{\"nome\":\"teste\"}", "nome").toString() == "teste"); | |
98 | +} | |
99 | + | |
110 | 100 | void CTestCacic::testLogin(){ |
111 | 101 | QJsonObject json = OCacicComm.login(); |
112 | 102 | QJsonValue sessionvalue = OCacic.jsonValueFromJsonString(json["reply"].toString(), "session"); |
113 | -// qDebug() << sessionvalue.toString(); | |
103 | + qDebug() << sessionvalue.toString(); | |
114 | 104 | QVERIFY(!sessionvalue.isNull()); |
115 | 105 | } |
116 | 106 | |
... | ... | @@ -122,9 +112,19 @@ void CTestCacic::testSslConnection() |
122 | 112 | QVERIFY(jsonvalue.toString() == "200" || jsonvalue.toString() == "302"); |
123 | 113 | } |
124 | 114 | |
125 | -void CTestCacic::testJsonValueFromJsonString() | |
126 | -{ | |
127 | - QVERIFY(OCacic.jsonValueFromJsonString("{\"nome\":\"teste\"}", "nome").toString() == "teste"); | |
115 | +void CTestCacic::testEnCrypt(){ | |
116 | + std::string key = "qwertyuiopasdfghjklzxcvbnmqwerty"; //chave de 256 bits (32 caracteres) | |
117 | + std::string IV = "0123456789123456"; //iv nunca se repete para a mesma senha. | |
118 | + std::string input = "aqui vai a url que sera encriptada"; | |
119 | + QVERIFY(OCacic.enCrypt(input, key, IV) == "Va2WiUrdTVrn93tCrtx0njjU4HDpn7VFCsCVr/+YgaBCVQ=="); | |
120 | +} | |
121 | + | |
122 | +void CTestCacic::testDeCrypt(){ | |
123 | + std::string key = "qwertyuiopasdfghjklzxcvbnmqwerty"; //chave de 256 bits (32 caracteres) | |
124 | + std::string IV = "0123456789123456asas"; //iv nunca se repete para a mesma senha. | |
125 | + std::string input = "Va2WiUrdTVrn93tCrtx0njjU4HDpn7VFCsCVr/+YgaBCVQ=="; | |
126 | + QVERIFY(OCacic.deCrypt(input, key, IV) == "aqui vai a url que sera encriptada"); | |
127 | + | |
128 | 128 | } |
129 | 129 | |
130 | 130 | void CTestCacic::cleanupTestCase() | ... | ... |
cacic-teste/testcacic.h
... | ... | @@ -37,17 +37,17 @@ private slots: |
37 | 37 | void testComm(); |
38 | 38 | void testGetAndSetValueFromFile(); |
39 | 39 | void testGetValueFromTags(); |
40 | - void testEnCrypt(); | |
41 | - void testDeCrypt(); | |
42 | 40 | void testCreateFolder(); |
43 | 41 | void testDeleteFolder(); |
44 | 42 | void testDeleteFile(); |
45 | 43 | void testInterfaceDeRede(); |
46 | 44 | void testPegarUsu(); |
45 | + void testJsonValueFromJsonString(); | |
47 | 46 | void testpegarOS(); |
48 | 47 | void testLogin(); |
49 | 48 | void testSslConnection(); |
50 | - void testJsonValueFromJsonString(); | |
49 | + void testEnCrypt(); | |
50 | + void testDeCrypt(); | |
51 | 51 | void cleanupTestCase(); |
52 | 52 | }; |
53 | 53 | ... | ... |