tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_util_bugbug.py (1605B)


      1 # This Source Code Form is subject to the terms of the Mozilla Public
      2 # License, v. 2.0. If a copy of the MPL was not distributed with this
      3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
      4 
      5 
      6 import mozunit
      7 
      8 from gecko_taskgraph.util.bugbug import BUGBUG_BASE_URL, push_schedules
      9 
     10 
     11 def test_group_translation(responses):
     12    branch = ("integration/autoland",)
     13    rev = "abcdef"
     14    query = f"/push/{branch}/{rev}/schedules"
     15    url = BUGBUG_BASE_URL + query
     16 
     17    responses.add(
     18        responses.GET,
     19        url,
     20        json={
     21            "groups": {
     22                "dom/indexedDB": 1,
     23                "testing/web-platform/tests/IndexedDB": 1,
     24                "testing/web-platform/mozilla/tests/IndexedDB": 1,
     25            },
     26            "config_groups": {
     27                "dom/indexedDB": ["label1", "label2"],
     28                "testing/web-platform/tests/IndexedDB": ["label3"],
     29                "testing/web-platform/mozilla/tests/IndexedDB": ["label4"],
     30            },
     31        },
     32        status=200,
     33    )
     34 
     35    assert len(push_schedules) == 0
     36    data = push_schedules(branch, rev)
     37    print(data)
     38    assert sorted(data["groups"]) == [
     39        "/IndexedDB",
     40        "/_mozilla/IndexedDB",
     41        "dom/indexedDB",
     42    ]
     43    assert data["config_groups"] == {
     44        "dom/indexedDB": ["label1", "label2"],
     45        "/IndexedDB": ["label3"],
     46        "/_mozilla/IndexedDB": ["label4"],
     47    }
     48    assert len(push_schedules) == 1
     49 
     50    # Value is memoized.
     51    responses.reset()
     52    push_schedules(branch, rev)
     53    assert len(push_schedules) == 1
     54 
     55 
     56 if __name__ == "__main__":
     57    mozunit.main()