test_create_and_label_carry_the_id_three_ways¶
Tests › tests/test_wiki_issues.py
What this test is for
Why it exists
Write side (used by `clew wiki serve`): create with title, label and marker line.
Given
gh = _Fake( {("POST", "https://api.github.com/repos/acme/demo/issues"): {"number": 3, "html_url": "u3"}} )made = GitHubIssues("acme/demo", token="t", opener=gh).create("REQ-1", "Title", "Body")
4 more
sent = json.loads(gh.seen[0][3])ado = _Fake( { ("POST", "https://dev.azure.com/org/proj/_apis/wit/workitems/$Issue?api-version=7.0"): { "id": 4 } } )made = AdoIssues("org/proj", token="p", opener=ado).create("REQ-1", "Title", "Body")patch = {op["path"]: op["value"] for op in json.loads(ado.seen[0][3])}
When
- —
Then
- ✓ made equals ("3", "u3")
- ✓ sent["labels"] equals ["req:REQ-1"]
- ✓ sent["body"] contains "clew-req: REQ-1"
- ✓ sent["title"].startswith("REQ-1") holds
- ✓ made equals ("4", "https://dev.azure.com/org/proj/_workitems/edit/4")
- ✓ patch["/fields/System.Tags"] equals "req:REQ-1"
- ✓ patch["/fields/System.Description"] contains "clew-req: REQ-1"
- ✓ ado.seen[0][2]["Content-type"] equals "application/json-patch+json"
tests/test_wiki_issues.py:148 · its file's page
What it checks (5)
assert ( made == ("3", "u3") and sent["labels"] == ["req:REQ-1"] and "clew-req: REQ-1" in sent["body"] )not attributedassert sent["title"].startswith("REQ-1")not attributedassert made == ("4", "https://dev.azure.com/org/proj/_workitems/edit/4")not attributedassert ( patch["/fields/System.Tags"] == "req:REQ-1" and "clew-req: REQ-1" in patch["/fields/System.Description"] )not attributedassert ado.seen[0][2]["Content-type"] == "application/json-patch+json"not attributed
What it reaches
Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.
Also reaches 1 requirement
Its run touches their code; that is reach, not proof.
- REQ-DDB-WIKI-028 measured