diff options
author | Tobias Markmann <tm@ayena.de> | 2016-03-31 14:57:35 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-03-31 14:57:35 (GMT) |
commit | cfbdb43d2cadd40aa87338d41548e4bf89e146e6 (patch) | |
tree | 18d94153a302445196fc0c18586abf44a1ce4a38 /Swiften/QA/TLSTest/CertificateTest.cpp | |
parent | 1d545a4a7fb877f021508094b88c1f17b30d8b4e (diff) | |
download | swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.zip swift-cfbdb43d2cadd40aa87338d41548e4bf89e146e6.tar.bz2 |
Convert tabs to 4 spaces for all source files
Removed trailing spaces and whitespace on empty lines
in the process.
Changed CheckTabs.py tool to disallow hard tabs in source
files.
Test-Information:
Manually checked 30 random files that the conversion worked
as expected.
Change-Id: I874f99d617bd3d2bb55f02d58f22f58f9b094480
Diffstat (limited to 'Swiften/QA/TLSTest/CertificateTest.cpp')
-rw-r--r-- | Swiften/QA/TLSTest/CertificateTest.cpp | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/Swiften/QA/TLSTest/CertificateTest.cpp b/Swiften/QA/TLSTest/CertificateTest.cpp index c9315d2..ede1063 100644 --- a/Swiften/QA/TLSTest/CertificateTest.cpp +++ b/Swiften/QA/TLSTest/CertificateTest.cpp @@ -20,81 +20,81 @@ using namespace Swift; template<typename CERTIFICATE_FACTORY> class CertificateTest : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(CertificateTest); - CPPUNIT_TEST(testConstructFromDER); - CPPUNIT_TEST(testToDER); - //CPPUNIT_TEST(testGetSubjectName); - CPPUNIT_TEST(testGetCommonNames); - CPPUNIT_TEST(testGetSRVNames); - CPPUNIT_TEST(testGetDNSNames); - CPPUNIT_TEST(testGetXMPPAddresses); - CPPUNIT_TEST_SUITE_END(); - - public: - void setUp() { - pathProvider = new PlatformApplicationPathProvider("FileReadBytestreamTest"); - readByteArrayFromFile(certificateData, (pathProvider->getExecutableDir() / "jabber_org.crt")); - certificateFactory = new CERTIFICATE_FACTORY(); - } - - void tearDown() { - delete certificateFactory; - delete pathProvider; - } - - void testConstructFromDER() { - Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); - - CPPUNIT_ASSERT_EQUAL(std::string("*.jabber.org"), testling->getCommonNames()[0]); - } - - void testToDER() { - Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); - - CPPUNIT_ASSERT_EQUAL(certificateData, testling->toDER()); - } + CPPUNIT_TEST_SUITE(CertificateTest); + CPPUNIT_TEST(testConstructFromDER); + CPPUNIT_TEST(testToDER); + //CPPUNIT_TEST(testGetSubjectName); + CPPUNIT_TEST(testGetCommonNames); + CPPUNIT_TEST(testGetSRVNames); + CPPUNIT_TEST(testGetDNSNames); + CPPUNIT_TEST(testGetXMPPAddresses); + CPPUNIT_TEST_SUITE_END(); + + public: + void setUp() { + pathProvider = new PlatformApplicationPathProvider("FileReadBytestreamTest"); + readByteArrayFromFile(certificateData, (pathProvider->getExecutableDir() / "jabber_org.crt")); + certificateFactory = new CERTIFICATE_FACTORY(); + } + + void tearDown() { + delete certificateFactory; + delete pathProvider; + } + + void testConstructFromDER() { + Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); + + CPPUNIT_ASSERT_EQUAL(std::string("*.jabber.org"), testling->getCommonNames()[0]); + } + + void testToDER() { + Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); + + CPPUNIT_ASSERT_EQUAL(certificateData, testling->toDER()); + } /* - void testGetSubjectName() { - Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData); - - CPPUNIT_ASSERT_EQUAL(std::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()); - } - */ - - void testGetCommonNames() { - Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); - - CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(testling->getCommonNames().size())); - CPPUNIT_ASSERT_EQUAL(std::string("*.jabber.org"), testling->getCommonNames()[0]); - } - - void testGetSRVNames() { - Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); - - CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(testling->getSRVNames().size())); - CPPUNIT_ASSERT_EQUAL(std::string("*.jabber.org"), testling->getSRVNames()[0]); - } - - void testGetDNSNames() { - Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); - - CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(testling->getDNSNames().size())); - CPPUNIT_ASSERT_EQUAL(std::string("*.jabber.org"), testling->getDNSNames()[0]); - CPPUNIT_ASSERT_EQUAL(std::string("jabber.org"), testling->getDNSNames()[1]); - } - - void testGetXMPPAddresses() { - Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); - - CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(testling->getXMPPAddresses().size())); - CPPUNIT_ASSERT_EQUAL(std::string("*.jabber.org"), testling->getXMPPAddresses()[0]); - } - - private: - PlatformApplicationPathProvider* pathProvider; - ByteArray certificateData; - CertificateFactory* certificateFactory; + void testGetSubjectName() { + Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData); + + CPPUNIT_ASSERT_EQUAL(std::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()); + } + */ + + void testGetCommonNames() { + Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); + + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(testling->getCommonNames().size())); + CPPUNIT_ASSERT_EQUAL(std::string("*.jabber.org"), testling->getCommonNames()[0]); + } + + void testGetSRVNames() { + Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); + + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(testling->getSRVNames().size())); + CPPUNIT_ASSERT_EQUAL(std::string("*.jabber.org"), testling->getSRVNames()[0]); + } + + void testGetDNSNames() { + Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); + + CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(testling->getDNSNames().size())); + CPPUNIT_ASSERT_EQUAL(std::string("*.jabber.org"), testling->getDNSNames()[0]); + CPPUNIT_ASSERT_EQUAL(std::string("jabber.org"), testling->getDNSNames()[1]); + } + + void testGetXMPPAddresses() { + Certificate::ref testling = Certificate::ref(certificateFactory->createCertificateFromDER(certificateData)); + + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(testling->getXMPPAddresses().size())); + CPPUNIT_ASSERT_EQUAL(std::string("*.jabber.org"), testling->getXMPPAddresses()[0]); + } + + private: + PlatformApplicationPathProvider* pathProvider; + ByteArray certificateData; + CertificateFactory* certificateFactory; }; #ifdef HAVE_OPENSSL |