test_ado_lists_open_work_items_through_wiql

Tests › tests/test_wiki_issues.py

passed Passed in the packaged run.

What this test is for

Why it exists

Azure DevOps: a WIQL query for open items, then one batch read of their fields.

Given

  1. base = "https://dev.azure.com/org/proj/_apis/wit"
  2. fake = _Fake( { ("POST", f"{base}/wiql?api-version=7.0"): {"workItems": [{"id": 7}, {"id": 9}]}, ( "GET", f"{base}/workitems?ids=7,9&fields=System.Title,System.Description,System.Tags,System.State&api-version=7.0", ): { "value": [ { "id": 7, "fields": { "System.Title": "A", "System.Tags": "req:REQ-1; ui", "System.State": "Active", }, }, { "id": 9, "fields": { "System.Title": "B", "System.Description": "<p>x</p>", "System.State": "New", }, }, ] }, } )
2 more
  1. issues = AdoIssues("org/proj", token="pat", opener=fake).list_open()
  2. auth = fake.seen[0][2]["Authorization"]
→

When

  1. —
→

Then

  1. ✓ [i.id for i in issues] equals ["7", "9"]
  2. ✓ issues[0].labels equals ("req:REQ-1", "ui")
  3. ✓ issues[0].url equals "https://dev.azure.com/org/proj/_workitems/edit/7"
  4. ✓ auth equals "Basic " + base64.b64encode(b":pat").decode()

tests/test_wiki_issues.py:90 · its file's page

What it checks (3)

  1. assert [i.id for i in issues] == ["7", "9"] and issues[0].labels == ("req:REQ-1", "ui") not attributed
  2. assert issues[0].url == "https://dev.azure.com/org/proj/_workitems/edit/7" not attributed
  3. assert auth == "Basic " + base64.b64encode(b":pat").decode() 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.