Added GeoLite DB files for testing purposes. Totally not cool for "unit" testing, but I gotta validate the concepts somehow. Tests will be refactored.
Signed-off-by: Adam Rocska <adam.rocska@adams.solutions>
This commit is contained in:
parent
5da03ef59d
commit
9827635299
|
@ -0,0 +1 @@
|
||||||
|
Database and Contents Copyright (c) 2020 MaxMind, Inc.
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
Use of this MaxMind product is governed by MaxMind's GeoLite2 End User License Agreement, which can be viewed at https://www.maxmind.com/en/geolite2/eula.
|
||||||
|
|
||||||
|
This database incorporates GeoNames [https://www.geonames.org] geographical data, which is made available under the Creative Commons Attribution 4.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by/4.0/.
|
|
@ -0,0 +1 @@
|
||||||
|
Database and Contents Copyright (c) 2020 MaxMind, Inc.
|
Binary file not shown.
After Width: | Height: | Size: 60 MiB |
|
@ -0,0 +1,3 @@
|
||||||
|
Use of this MaxMind product is governed by MaxMind's GeoLite2 End User License Agreement, which can be viewed at https://www.maxmind.com/en/geolite2/eula.
|
||||||
|
|
||||||
|
This database incorporates GeoNames [https://www.geonames.org] geographical data, which is made available under the Creative Commons Attribution 4.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by/4.0/.
|
|
@ -0,0 +1 @@
|
||||||
|
Latitude and longitude are not precise and should not be used to identify a particular street address or household.
|
|
@ -0,0 +1 @@
|
||||||
|
Database and Contents Copyright (c) 2020 MaxMind, Inc.
|
Binary file not shown.
|
@ -0,0 +1,3 @@
|
||||||
|
Use of this MaxMind product is governed by MaxMind's GeoLite2 End User License Agreement, which can be viewed at https://www.maxmind.com/en/geolite2/eula.
|
||||||
|
|
||||||
|
This database incorporates GeoNames [https://www.geonames.org] geographical data, which is made available under the Creative Commons Attribution 4.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by/4.0/.
|
|
@ -3,18 +3,46 @@ import XCTest
|
||||||
|
|
||||||
extension XCTestCase {
|
extension XCTestCase {
|
||||||
|
|
||||||
var bundle: Bundle {
|
static var bundle: Bundle {
|
||||||
get {
|
get {
|
||||||
guard let currentFileUrl = URL(string: #file) else {
|
guard let currentFileUrl = URL(string: #file) else { return Bundle.main }
|
||||||
return Bundle.main
|
|
||||||
}
|
|
||||||
|
|
||||||
guard let testBundle = Bundle(path: currentFileUrl.deletingLastPathComponent().path) else {
|
guard let testBundle = Bundle(path: currentFileUrl.deletingLastPathComponent().path) else {
|
||||||
return Bundle.main
|
return Bundle.main
|
||||||
}
|
}
|
||||||
|
|
||||||
return testBundle
|
return testBundle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var bundle: Bundle { get { return XCTestCase.bundle } }
|
||||||
|
|
||||||
|
private static var countryFilePath: String {
|
||||||
|
get {
|
||||||
|
guard let countryFilePath = bundle.path(
|
||||||
|
forResource: "GeoLite2-Country_20200421/GeoLite2-Country",
|
||||||
|
ofType: "mmdb"
|
||||||
|
) else { fatalError("GeoLite2 Country DB file was not found.") }
|
||||||
|
return countryFilePath
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static var cityFilePath: String {
|
||||||
|
get {
|
||||||
|
guard let countryFilePath = bundle.path(
|
||||||
|
forResource: "GeoLite2-City_20200526/GeoLite2-City",
|
||||||
|
ofType: "mmdb"
|
||||||
|
) else { fatalError("GeoLite2 Country DB file was not found.") }
|
||||||
|
return countryFilePath
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static var asnFilePath: String {
|
||||||
|
get {
|
||||||
|
guard let countryFilePath = bundle.path(
|
||||||
|
forResource: "GeoLite2-ASN_20200526/GeoLite2-ASN",
|
||||||
|
ofType: "mmdb"
|
||||||
|
) else { fatalError("GeoLite2 Country DB file was not found.") }
|
||||||
|
return countryFilePath
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue