Skip to content

Commit

Permalink
Add support for disableBackgroundUpdates (#1939)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah-clements authored Apr 22, 2021
1 parent 2061b7d commit eabc02d
Show file tree
Hide file tree
Showing 2 changed files with 143 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/auslib/blobs/schemas/apprelease-v9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@
enum:
- true
description: Whether or not to disable background downloads with BITS on the client
disableBackgroundUpdates:
type: boolean
enum:
- true
description: Whether or not to prevent an update from being downloaded in the background
# Top level fileUrls are useful primarily for release style builds,
# where the URLs are predictable and only vary by locale and platform.
# It"s worth noting that while we normally serve different channels
Expand Down
138 changes: 138 additions & 0 deletions tests/blobs/test_apprelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -3670,6 +3670,144 @@ def testDisableBITSFalseNotAllowed(self):
)
self.assertRaises(BlobValidationError, blob.validate, "h", self.whitelistedDomains)

def testDisableBackgroundUpdates(self):
blob = ReleaseBlobV9()
blob.loadJSON(
"""
{
"name": "bbb",
"schema_version": 9,
"hashFunction": "sha512",
"appVersion": "68.0",
"displayVersion": "68.0",
"updateLine": [
{
"for": {},
"fields": {
"detailsURL": "http://example.org/%LOCALE%",
"disableBackgroundUpdates": true,
"type": "minor"
}
}
],
"fileUrls": {
"*": {
"partials": {
"bb": "http://a.com/bb-partial"
},
"completes": {
"*": "http://a.com/complete"
}
}
},
"platforms": {
"p": {
"buildID": 50,
"OS_FTP": "p",
"OS_BOUNCER": "p",
"locales": {
"en-US": {
"partials": [
{
"filesize": 8,
"from": "h1",
"hashValue": "9"
}
],
"completes": [
{
"filesize": 40,
"from": "*",
"hashValue": "41"
}
]
}
}
}
}
}
"""
)
blob.validate("h", self.whitelistedDomains)
updateQuery = {
"product": "b",
"buildID": "23",
"version": "65.0",
"buildTarget": "p",
"locale": "en-US",
"channel": "release",
"osVersion": "a",
"distribution": "a",
"distVersion": "a",
"force": None,
}
returned_header = blob.getInnerHeaderXML(updateQuery, "minor", self.whitelistedDomains, self.specialForceHosts)
expected_header = (
'<update appVersion="68.0" buildID="50" detailsURL="http://example.org/en-US" disableBackgroundUpdates="true"'
' displayVersion="68.0" type="minor">'
)
self.assertEqual(returned_header.strip(), expected_header.strip())

def testDisableBackgroundUpdatesFalseNotAllowed(self):
blob = ReleaseBlobV9()
blob.loadJSON(
"""
{
"name": "bbb",
"schema_version": 9,
"hashFunction": "sha512",
"appVersion": "68.0",
"displayVersion": "68.0",
"updateLine": [
{
"for": {},
"fields": {
"detailsURL": "http://example.org/%LOCALE%",
"disableBackgroundUpdates": false,
"type": "minor"
}
}
],
"fileUrls": {
"*": {
"partials": {
"bb": "http://a.com/bb-partial"
},
"completes": {
"*": "http://a.com/complete"
}
}
},
"platforms": {
"p": {
"buildID": 50,
"OS_FTP": "p",
"OS_BOUNCER": "p",
"locales": {
"en-US": {
"partials": [
{
"filesize": 8,
"from": "h1",
"hashValue": "9"
}
],
"completes": [
{
"filesize": 40,
"from": "*",
"hashValue": "41"
}
]
}
}
}
}
}
"""
)
self.assertRaises(BlobValidationError, blob.validate, "h", self.whitelistedDomains)


@pytest.mark.parametrize(
"for1,for2",
Expand Down

0 comments on commit eabc02d

Please sign in to comment.