Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
humitos committed Aug 7, 2024
1 parent fdcb280 commit 235514a
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions readthedocs/projects/tests/test_build_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,11 @@ def test_successful_build(
"builder": mock.ANY,
}

# NOTE: `request_history[5]` is a temporal notification that will be removed after October 7th
# https://github.com/readthedocs/readthedocs.org/pull/11514

# Update build state: installing
assert self.requests_mock.request_history[5].json() == {
assert self.requests_mock.request_history[6].json() == {
"id": 1,
"state": "installing",
"commit": "a1b2c3",
Expand Down Expand Up @@ -599,7 +602,7 @@ def test_successful_build(
},
}
# Update build state: building
assert self.requests_mock.request_history[6].json() == {
assert self.requests_mock.request_history[7].json() == {
"id": 1,
"state": "building",
"commit": "a1b2c3",
Expand All @@ -609,7 +612,7 @@ def test_successful_build(
"error": "",
}
# Update build state: uploading
assert self.requests_mock.request_history[7].json() == {
assert self.requests_mock.request_history[8].json() == {
"id": 1,
"state": "uploading",
"commit": "a1b2c3",
Expand All @@ -619,9 +622,9 @@ def test_successful_build(
"error": "",
}
# Update version state
assert self.requests_mock.request_history[8]._request.method == "PATCH"
assert self.requests_mock.request_history[8].path == "/api/v2/version/1/"
assert self.requests_mock.request_history[8].json() == {
assert self.requests_mock.request_history[9]._request.method == "PATCH"
assert self.requests_mock.request_history[9].path == "/api/v2/version/1/"
assert self.requests_mock.request_history[9].json() == {
"addons": False,
"build_data": None,
"built": True,
Expand All @@ -631,11 +634,13 @@ def test_successful_build(
"has_htmlzip": True,
}
# Set project has valid clone
assert self.requests_mock.request_history[9]._request.method == "PATCH"
assert self.requests_mock.request_history[9].path == "/api/v2/project/1/"
assert self.requests_mock.request_history[9].json() == {"has_valid_clone": True}
# Update build state: finished, success and builder
assert self.requests_mock.request_history[10]._request.method == "PATCH"
assert self.requests_mock.request_history[10].path == "/api/v2/project/1/"
assert self.requests_mock.request_history[10].json() == {
"has_valid_clone": True
}
# Update build state: finished, success and builder
assert self.requests_mock.request_history[11].json() == {
"id": 1,
"state": "finished",
"commit": "a1b2c3",
Expand All @@ -647,8 +652,8 @@ def test_successful_build(
"error": "",
}

assert self.requests_mock.request_history[11]._request.method == "POST"
assert self.requests_mock.request_history[11].path == "/api/v2/revoke/"
assert self.requests_mock.request_history[12]._request.method == "POST"
assert self.requests_mock.request_history[12].path == "/api/v2/revoke/"

assert BuildData.objects.all().exists()

Expand Down

0 comments on commit 235514a

Please sign in to comment.