summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-11-09 21:18:05 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-11-09 21:41:52 (GMT)
commitbc5b3a02de2e9131bff940c9667f28b2ae588807 (patch)
tree12db51e814fa92c219e102354f881a111e9f4f99 /Swiften/QA
parentd27e3cbf2c9c99cb989d641466f252c6277c78fe (diff)
downloadswift-contrib-bc5b3a02de2e9131bff940c9667f28b2ae588807.zip
swift-contrib-bc5b3a02de2e9131bff940c9667f28b2ae588807.tar.bz2
Certificate::getCommonName -> getCommonNames.
Diffstat (limited to 'Swiften/QA')
-rw-r--r--Swiften/QA/OpenSSLTest/OpenSSLCertificateTest.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/Swiften/QA/OpenSSLTest/OpenSSLCertificateTest.cpp b/Swiften/QA/OpenSSLTest/OpenSSLCertificateTest.cpp
index 43519d7..59aee47 100644
--- a/Swiften/QA/OpenSSLTest/OpenSSLCertificateTest.cpp
+++ b/Swiften/QA/OpenSSLTest/OpenSSLCertificateTest.cpp
@@ -17,11 +17,13 @@ class OpenSSLCertificateTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(OpenSSLCertificateTest);
CPPUNIT_TEST(testConstructFromDER);
CPPUNIT_TEST(testToDER);
+ CPPUNIT_TEST(testGetSubjectName);
CPPUNIT_TEST_SUITE_END();
public:
void setUp() {
pathProvider = new PlatformApplicationPathProvider("FileReadBytestreamTest");
+ certificateData.readFromFile((pathProvider->getExecutableDir() / "jabber_org.crt").string());
}
void tearDown() {
@@ -29,23 +31,26 @@ class OpenSSLCertificateTest : public CppUnit::TestFixture {
}
void testConstructFromDER() {
- ByteArray in;
- in.readFromFile((pathProvider->getExecutableDir() / "jabber_org.crt").string());
- OpenSSLCertificate testling(in);
+ OpenSSLCertificate testling(certificateData);
- CPPUNIT_ASSERT_EQUAL(String("*.jabber.org"), testling.getCommonName());
+ CPPUNIT_ASSERT_EQUAL(String("*.jabber.org"), testling.getCommonNames()[0]);
}
void testToDER() {
- ByteArray in;
- in.readFromFile((pathProvider->getExecutableDir() / "jabber_org.crt").string());
- OpenSSLCertificate testling(in);
+ OpenSSLCertificate testling(certificateData);
- CPPUNIT_ASSERT_EQUAL(in, testling.toDER());
+ CPPUNIT_ASSERT_EQUAL(certificateData, testling.toDER());
+ }
+
+ void testGetSubjectName() {
+ OpenSSLCertificate testling(certificateData);
+
+ CPPUNIT_ASSERT_EQUAL(String("/description=114072-VMk8pdi1aj5kTXxO/C=US/ST=Colorado/L=Denver/O=Peter Saint-Andre/OU=StartCom Trusted Certificate Member/CN=*.jabber.org/emailAddress=hostmaster@jabber.org"), testling.getSubjectName());
}
private:
PlatformApplicationPathProvider* pathProvider;
+ ByteArray certificateData;
};
CPPUNIT_TEST_SUITE_REGISTRATION(OpenSSLCertificateTest);