mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-24 04:38:16 +00:00
Add tests for informational only updates
This commit is contained in:
1 parent
da30373a30
commit
686fd05fce
3 files changed
+119
No files matched your search
@@ -161,6 +161,7 @@
|
||||
721D8A811D498B9B0032E472 /* Updater.app in Copy Tools */ = {isa = PBXBuildFile; fileRef = 721C24451CB753E6005440CB /* Updater.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
721D8A861D4ADFEB0032E472 /* SPULocalCacheDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = 721BC20D1D1CDE55002BC71E /* SPULocalCacheDirectory.m */; };
|
||||
721D8A871D4C5BF10032E472 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; };
|
||||
722545B626805FF80036465C /* testappcast_info_updates.xml in Resources */ = {isa = PBXBuildFile; fileRef = 722545B526805FF80036465C /* testappcast_info_updates.xml */; };
|
||||
7229E1B61C97C91100CB50D0 /* SPUUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7229E1B51C97C91100CB50D0 /* SPUUpdateDriver.h */; };
|
||||
7229E1B91C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7229E1B71C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.h */; };
|
||||
7229E1BA1C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7229E1B81C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.m */; };
|
||||
@@ -957,6 +958,7 @@
|
||||
722194521D3BFEB7004C34FF /* SUInstallerAgentInitiationProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SUInstallerAgentInitiationProtocol.h; path = Sparkle/InstallerProgress/SUInstallerAgentInitiationProtocol.h; sourceTree = SOURCE_ROOT; };
|
||||
7223E7611AD1AEFF008E3161 /* sais.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sais.c; sourceTree = "<group>"; };
|
||||
7223E7621AD1AEFF008E3161 /* sais.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sais.h; sourceTree = "<group>"; };
|
||||
722545B526805FF80036465C /* testappcast_info_updates.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = testappcast_info_updates.xml; sourceTree = "<group>"; };
|
||||
722589B51E0A24B9005EA0B9 /* Security.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Security.md; sourceTree = "<group>"; };
|
||||
722589B61E0A24C6005EA0B9 /* Design Practices.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = "Design Practices.md"; sourceTree = "<group>"; };
|
||||
7229E1B51C97C91100CB50D0 /* SPUUpdateDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUUpdateDriver.h; sourceTree = "<group>"; };
|
||||
@@ -1683,6 +1685,7 @@
|
||||
5AF6C74E1AEA46D10014A3AB /* test.pkg */,
|
||||
5AD0FA7E1C73F2E2004BCEFF /* testappcast.xml */,
|
||||
725B3A81263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml */,
|
||||
722545B526805FF80036465C /* testappcast_info_updates.xml */,
|
||||
5F1510A11C96E591006E1629 /* testnamespaces.xml */,
|
||||
FA30773C24CBC295007BA37D /* testlocalizedreleasenotesappcast.xml */,
|
||||
5A5DD41B249F0F4B0045EB3E /* test-relative-urls.xml */,
|
||||
@@ -2944,6 +2947,7 @@
|
||||
5AF6C74F1AEA46D10014A3AB /* test.pkg in Resources */,
|
||||
5AD0FA7F1C73F2E2004BCEFF /* testappcast.xml in Resources */,
|
||||
FA30773D24CBC295007BA37D /* testlocalizedreleasenotesappcast.xml in Resources */,
|
||||
722545B626805FF80036465C /* testappcast_info_updates.xml in Resources */,
|
||||
5F1510A21C96E591006E1629 /* testnamespaces.xml in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
|
||||
<channel>
|
||||
<title>For unit test only</title>
|
||||
<!-- Release with enclosure download -->
|
||||
<item>
|
||||
<title>Version 2.0</title>
|
||||
<description>desc</description>
|
||||
<pubDate>Sat, 26 Jul 2014 15:20:11 +0000</pubDate>
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" sparkle:version="2.0" />
|
||||
</item>
|
||||
<!-- Release that is informational updating from 2.4 and 2.5 -->
|
||||
<item>
|
||||
<title>Version 3.0</title>
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" sparkle:version="3.0" length="1346234" />
|
||||
<sparkle:informationalUpdate>
|
||||
<sparkle:version>2.5</sparkle:version>
|
||||
<sparkle:version>2.4</sparkle:version>
|
||||
</sparkle:informationalUpdate>
|
||||
<link>http://sparkle-project.org</link>
|
||||
</item>
|
||||
<!-- Release that is always informational -->
|
||||
<item>
|
||||
<title>Version 4.0</title>
|
||||
<pubDate>Sat, 26 Jul 2014 15:20:13 +0000</pubDate>
|
||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" sparkle:version="4.0" length="1346234" />
|
||||
<sparkle:informationalUpdate></sparkle:informationalUpdate>
|
||||
<link>http://sparkle-project.org</link>
|
||||
<sparkle:deltas>
|
||||
<enclosure url="http://localhost:1337/3.0_from_2.0.patch"
|
||||
sparkle:version="3.0"
|
||||
sparkle:deltaFrom="2.0"
|
||||
length="1235"
|
||||
type="application/octet-stream"
|
||||
sparkle:edSignature="..." />
|
||||
|
||||
<enclosure url="http://localhost:1337/3.0_from_1.0.patch"
|
||||
sparkle:version="3.0"
|
||||
sparkle:deltaFrom="1.0"
|
||||
length="1485"
|
||||
type="application/octet-stream"
|
||||
sparkle:edSignature="..." />
|
||||
</sparkle:deltas>
|
||||
</item>
|
||||
<!-- Release that is always informational (implicitly without enclosure item) -->
|
||||
<item>
|
||||
<title>Version 5.0</title>
|
||||
<sparkle:version>5.0</sparkle:version>
|
||||
<link>http://sparkle-project.org</link>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
@@ -116,6 +116,69 @@ class SUAppcastTest: XCTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
func testInformationalUpdateVersions() {
|
||||
let testURL = Bundle(for: SUAppcastTest.self).url(forResource: "testappcast_info_updates", withExtension: "xml")!
|
||||
|
||||
do {
|
||||
let testData = try Data(contentsOf: testURL)
|
||||
|
||||
let versionComparator = SUStandardVersionComparator.default()
|
||||
|
||||
// Test informational updates from version 1.0
|
||||
do {
|
||||
let hostVersion = "1.0"
|
||||
let stateResolver = SPUAppcastItemStateResolver(hostVersion: hostVersion, applicationVersionComparator: versionComparator, standardVersionComparator: versionComparator)
|
||||
|
||||
let appcast = try SUAppcast(xmlData: testData, relativeTo: nil, stateResolver: stateResolver)
|
||||
|
||||
XCTAssertFalse(appcast.items[0].isInformationOnlyUpdate)
|
||||
XCTAssertFalse(appcast.items[1].isInformationOnlyUpdate)
|
||||
XCTAssertTrue(appcast.items[2].isInformationOnlyUpdate)
|
||||
XCTAssertTrue(appcast.items[3].isInformationOnlyUpdate)
|
||||
|
||||
// Test delta updates inheriting informational only updates
|
||||
do {
|
||||
let deltaUpdate = appcast.items[2].deltaUpdates!["2.0"] as! SUAppcastItem
|
||||
XCTAssertTrue(deltaUpdate.isInformationOnlyUpdate)
|
||||
}
|
||||
}
|
||||
|
||||
// Test informational updates from version 2.4
|
||||
do {
|
||||
let hostVersion = "2.4"
|
||||
let stateResolver = SPUAppcastItemStateResolver(hostVersion: hostVersion, applicationVersionComparator: versionComparator, standardVersionComparator: versionComparator)
|
||||
|
||||
let appcast = try SUAppcast(xmlData: testData, relativeTo: nil, stateResolver: stateResolver)
|
||||
|
||||
XCTAssertTrue(appcast.items[1].isInformationOnlyUpdate)
|
||||
}
|
||||
|
||||
// Test informational updates from version 2.5
|
||||
do {
|
||||
let hostVersion = "2.5"
|
||||
let stateResolver = SPUAppcastItemStateResolver(hostVersion: hostVersion, applicationVersionComparator: versionComparator, standardVersionComparator: versionComparator)
|
||||
|
||||
let appcast = try SUAppcast(xmlData: testData, relativeTo: nil, stateResolver: stateResolver)
|
||||
|
||||
XCTAssertTrue(appcast.items[1].isInformationOnlyUpdate)
|
||||
}
|
||||
|
||||
// Test informational updates from version 2.6
|
||||
do {
|
||||
let hostVersion = "2.6"
|
||||
let stateResolver = SPUAppcastItemStateResolver(hostVersion: hostVersion, applicationVersionComparator: versionComparator, standardVersionComparator: versionComparator)
|
||||
|
||||
let appcast = try SUAppcast(xmlData: testData, relativeTo: nil, stateResolver: stateResolver)
|
||||
|
||||
XCTAssertFalse(appcast.items[1].isInformationOnlyUpdate)
|
||||
}
|
||||
|
||||
} catch let err as NSError {
|
||||
NSLog("%@", err)
|
||||
XCTFail(err.localizedDescription)
|
||||
}
|
||||
}
|
||||
|
||||
func testMinimumAutoupdateVersion() {
|
||||
let testURL = Bundle(for: SUAppcastTest.self).url(forResource: "testappcast_minimumAutoupdateVersion", withExtension: "xml")!
|
||||
|
||||
|
||||
Reference in new issue
Block a user