|
| 1 | +""" |
| 2 | +GitLab API: https://docs.gitlab.com/ee/api/iterations.html |
| 3 | +""" |
| 4 | + |
| 5 | +importre |
| 6 | + |
| 7 | +importpytest |
| 8 | +importresponses |
| 9 | + |
| 10 | +iterations_content= [ |
| 11 | + { |
| 12 | +"id":53, |
| 13 | +"iid":13, |
| 14 | +"group_id":5, |
| 15 | +"title":"Iteration II", |
| 16 | +"description":"Ipsum Lorem ipsum", |
| 17 | +"state":2, |
| 18 | +"created_at":"2020-01-27T05:07:12.573Z", |
| 19 | +"updated_at":"2020-01-27T05:07:12.573Z", |
| 20 | +"due_date":"2020-02-01", |
| 21 | +"start_date":"2020-02-14", |
| 22 | +"web_url":"http://gitlab.example.com/groups/my-group/-/iterations/13", |
| 23 | + } |
| 24 | +] |
| 25 | + |
| 26 | + |
| 27 | +@pytest.fixture |
| 28 | +defresp_iterations_list(): |
| 29 | +withresponses.RequestsMock()asrsps: |
| 30 | +rsps.add( |
| 31 | +method=responses.GET, |
| 32 | +url=re.compile(r"http://localhost/api/v4/(groups|projects)/1/iterations"), |
| 33 | +json=iterations_content, |
| 34 | +content_type="application/json", |
| 35 | +status=200, |
| 36 | + ) |
| 37 | +yieldrsps |
| 38 | + |
| 39 | + |
| 40 | +deftest_list_group_iterations(group,resp_iterations_list): |
| 41 | +iterations=group.iterations.list() |
| 42 | +assertiterations[0].group_id==5 |
| 43 | + |
| 44 | + |
| 45 | +deftest_list_project_iterations(project,resp_iterations_list): |
| 46 | +iterations=project.iterations.list() |
| 47 | +assertiterations[0].group_id==5 |