mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 10:55:46 -05:00
[libcalamares] Add unittests for GeoIPFixed
- Ignores the data, just returns selector
This commit is contained in:
parent
d9effb4ba7
commit
672f506e72
2 changed files with 34 additions and 0 deletions
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "GeoIPTests.h"
|
||||
|
||||
#include "GeoIPFixed.h"
|
||||
#include "GeoIPJSON.h"
|
||||
#ifdef QT_XML_LIB
|
||||
#include "GeoIPXML.h"
|
||||
|
@ -240,3 +241,35 @@ GeoIPTests::testGet()
|
|||
CHECK_GET( XML, QString(), "https://geoip.kde.org/v1/ubiquity" ) // Temporary KDE service
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
GeoIPTests::testFixed()
|
||||
{
|
||||
{
|
||||
GeoIPFixed f;
|
||||
auto tz = f.processReply( QByteArray() );
|
||||
QCOMPARE( tz.first, QStringLiteral( "Europe" ) );
|
||||
QCOMPARE( tz.second, QStringLiteral( "Amsterdam" ) );
|
||||
|
||||
QCOMPARE( f.processReply( xml_data_ubiquity ), tz );
|
||||
QCOMPARE( f.processReply( QByteArray( "derp" ) ), tz );
|
||||
}
|
||||
{
|
||||
GeoIPFixed f( QStringLiteral( "America/Vancouver" ) );
|
||||
auto tz = f.processReply( QByteArray() );
|
||||
QCOMPARE( tz.first, QStringLiteral( "America" ) );
|
||||
QCOMPARE( tz.second, QStringLiteral( "Vancouver" ) );
|
||||
|
||||
QCOMPARE( f.processReply( xml_data_ubiquity ), tz );
|
||||
QCOMPARE( f.processReply( QByteArray( "derp" ) ), tz );
|
||||
}
|
||||
{
|
||||
GeoIPFixed f( QStringLiteral( "America/North Dakota/Beulah" ) );
|
||||
auto tz = f.processReply( QByteArray() );
|
||||
QCOMPARE( tz.first, QStringLiteral( "America" ) );
|
||||
QCOMPARE( tz.second, QStringLiteral( "North_Dakota/Beulah" ) );
|
||||
|
||||
QCOMPARE( f.processReply( xml_data_ubiquity ), tz );
|
||||
QCOMPARE( f.processReply( QByteArray( "derp" ) ), tz );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ public:
|
|||
|
||||
private Q_SLOTS:
|
||||
void initTestCase();
|
||||
void testFixed();
|
||||
void testJSON();
|
||||
void testJSONalt();
|
||||
void testJSONbad();
|
||||
|
|
Loading…
Add table
Reference in a new issue