Skip to content

Commit fbb2856

Browse files
committed
change tests to use mock data templates
1 parent 50ec7f0 commit fbb2856

File tree

53 files changed

+825
-766
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+825
-766
lines changed

src/api/routes/issues.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -314,14 +314,13 @@ pub async fn get_blocked_issues<G: GitProvider + 'static>(
314314
format_error_list(&created_threads.thread_errors)
315315
)));
316316
}
317-
let statuses = created_threads
318-
.entries
319-
.into_values()
320-
.map(|entry| BlockedIssueStatus {
321-
issue: entry.issue,
322-
qc_status: entry.qc_status,
323-
})
324-
.collect();
317+
318+
// Merge cached statuses with newly fetched ones
319+
let mut statuses = blocked_statuses;
320+
statuses.extend(created_threads.entries.into_values().map(|entry| BlockedIssueStatus {
321+
issue: entry.issue,
322+
qc_status: entry.qc_status,
323+
}));
325324

326325
Ok(Json(statuses))
327326
}

src/api/tests/cases/assignees/list_assignees_success.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@ description: "Retrieve repository assignees with login and name"
33

44
fixtures:
55
users:
6-
- repository_users.json
6+
- type: mock
7+
login: "octocat"
8+
name: "The Octocat"
9+
- type: mock
10+
login: "reviewer1"
11+
12+
713

814
git_state: {}
915

src/api/tests/cases/comments/post_approve_blocked.yaml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,36 @@ description: "Fail to approve when gating QC is not approved"
33

44
fixtures:
55
issues:
6-
- test_file_issue.json # Issue #1 - open (not approved)
7-
- issue_with_blocking.json # Issue #2 - has #1 as Gating QC
6+
- type: mock
7+
number: 1
8+
title: "src/test.rs"
9+
body: |
10+
Quality check issue for src/test.rs
11+
12+
## Metadata
13+
initial qc commit: 456def789abc012345678901234567890123cdef
14+
git branch: main
15+
author: The Octocat <octocat@example.com>
16+
milestone: 1
17+
- type: mock
18+
number: 2
19+
title: "src/config.rs"
20+
body: |
21+
Quality check issue for src/config.rs
22+
23+
## Metadata
24+
initial qc commit: 456def789abc012345678901234567890123cdef
25+
git branch: feature/config-update
26+
author: Jane Developer <developer@example.com>
27+
28+
## Relevant Files
29+
30+
### Gating QC
31+
- [src/test.rs](https://github.com/owner/repo/issues/1) - Must be approved before this file
32+
33+
### Previous QC
34+
None
35+
milestone: 1
836

937
git_state: {}
1038

src/api/tests/cases/comments/post_approve_force.yaml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,36 @@ description: "Successfully approve with force=true even when gating QC is not ap
33

44
fixtures:
55
issues:
6-
- test_file_issue.json # Issue #1 - open (not approved)
7-
- issue_with_blocking.json # Issue #2 - has #1 as Gating QC
6+
- type: mock
7+
number: 1
8+
title: "src/test.rs"
9+
body: |
10+
Quality check issue for src/test.rs
11+
12+
## Metadata
13+
initial qc commit: 456def789abc012345678901234567890123cdef
14+
git branch: main
15+
author: The Octocat <octocat@example.com>
16+
milestone: 1
17+
- type: mock
18+
number: 2
19+
title: "src/config.rs"
20+
body: |
21+
Quality check issue for src/config.rs
22+
23+
## Metadata
24+
initial qc commit: 456def789abc012345678901234567890123cdef
25+
git branch: feature/config-update
26+
author: Jane Developer <developer@example.com>
27+
28+
## Relevant Files
29+
30+
### Gating QC
31+
- [src/test.rs](https://github.com/owner/repo/issues/1) - Must be approved before this file
32+
33+
### Previous QC
34+
None
35+
milestone: 1
836

937
git_state: {}
1038

src/api/tests/cases/comments/post_approve_success.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@ description: "Successfully approve an issue and close it"
33

44
fixtures:
55
issues:
6-
- test_file_issue.json
6+
- type: mock
7+
number: 1
8+
title: "src/test.rs"
9+
body: |
10+
Quality check issue for src/test.rs
11+
12+
## Metadata
13+
initial qc commit: 456def789abc012345678901234567890123cdef
14+
git branch: main
15+
author: The Octocat <octocat@example.com>
16+
milestone: 1
717

818
git_state: {}
919

src/api/tests/cases/comments/post_comment_success.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@ description: "Successfully create a comment on an existing issue"
33

44
fixtures:
55
issues:
6-
- test_file_issue.json
6+
- type: mock
7+
number: 1
8+
title: "src/test.rs"
9+
body: |
10+
Quality check issue for src/test.rs
11+
12+
## Metadata
13+
initial qc commit: 456def789abc012345678901234567890123cdef
14+
git branch: main
15+
author: The Octocat <octocat@example.com>
16+
milestone: 1
717

818
git_state: {}
919

src/api/tests/cases/comments/post_review_success.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@ description: "Successfully create a comment on an existing issue"
44
fixtures:
55
milestones: []
66
issues:
7-
- test_file_issue.json
7+
- type: mock
8+
number: 1
9+
title: "src/test.rs"
10+
body: |
11+
Quality check issue for src/test.rs
12+
13+
## Metadata
14+
initial qc commit: 456def789abc012345678901234567890123cdef
15+
git branch: main
16+
author: The Octocat <octocat@example.com>
17+
milestone: 1
818

919
git_state: {}
1020

src/api/tests/cases/comments/post_unapprove_success.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,17 @@ description: "Successfully unapprove an issue and re-open it"
33

44
fixtures:
55
issues:
6-
- test_file_issue.json
6+
- type: mock
7+
number: 1
8+
title: "src/test.rs"
9+
body: |
10+
Quality check issue for src/test.rs
11+
12+
## Metadata
13+
initial qc commit: 456def789abc012345678901234567890123cdef
14+
git branch: main
15+
author: The Octocat <octocat@example.com>
16+
milestone: 1
717

818
git_state: {}
919

src/api/tests/cases/configuration/get_configuration_status_success.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: "GET /api/configuration/status"
22
description: "Successfully fetch configuration repository status"
33

44
fixtures:
5-
milestones:
6-
- v1.0.json
75

86
git_state:
97
commit: "abc123"

src/api/tests/cases/issues/batch_get_issue_status_blocking.yaml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,36 @@ description: "Verify blocking_qc_status is populated by parsing issue body for b
33

44
fixtures:
55
issues:
6-
- test_file_issue.json # Issue #1 (blocking)
7-
- issue_with_blocking.json # Issue #2 (has Gating QC: #1 in body)
6+
- type: mock
7+
number: 1
8+
title: "src/test.rs"
9+
body: |
10+
Quality check issue for src/test.rs
11+
12+
## Metadata
13+
initial qc commit: 456def789abc012345678901234567890123cdef
14+
git branch: main
15+
author: The Octocat <octocat@example.com>
16+
milestone: 1
17+
- type: mock
18+
number: 2
19+
title: "src/config.rs"
20+
body: |
21+
Quality check issue for src/config.rs
22+
23+
## Metadata
24+
initial qc commit: 456def789abc012345678901234567890123cdef
25+
git branch: feature/config-update
26+
author: Jane Developer <developer@example.com>
27+
28+
## Relevant Files
29+
30+
### Gating QC
31+
- [src/test.rs](https://github.com/owner/repo/issues/1) - Must be approved before this file
32+
33+
### Previous QC
34+
None
35+
milestone: 1
836

937
git_state:
1038
commit: "abc123"

0 commit comments

Comments
 (0)