Commit f8283ae6 authored by Tim Knight's avatar Tim Knight Committed by Nejc Habjan
Browse files

test: update tests for gitlab 16.8 functionality



- use programmatic dates for expires_at in tokens tests
- set PAT for 16.8 into tests

Signed-off-by: default avatarTim Knight <tim.knight1@engineering.digital.dwp.gov.uk>
parent ea8c4c2b
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -9,6 +9,8 @@ CLI examples
CI Lint
-------

**ci-lint has been Removed in Gitlab 16, use project-ci-lint instead**

Lint a CI YAML configuration from a string:

.. note::
@@ -39,6 +41,9 @@ Validate a CI YAML configuration from a file (lints and exits with non-zero on f

   $ gitlab ci-lint validate --content @.gitlab-ci.yml

Project CI Lint
---------------

Lint a project's CI YAML configuration:

.. code-block:: console
+6 −2
Original line number Diff line number Diff line
from datetime import date


def test_project_deploy_tokens(gl, project):
    today = date.today().isoformat()
    deploy_token = project.deploytokens.create(
        {
            "name": "foo",
            "username": "bar",
            "expires_at": "2022-01-01",
            "expires_at": today,
            "scopes": ["read_registry"],
        }
    )
@@ -12,7 +16,7 @@ def test_project_deploy_tokens(gl, project):

    deploy_token = project.deploytokens.get(deploy_token.id)
    assert deploy_token.name == "foo"
    assert deploy_token.expires_at == "2022-01-01T00:00:00.000Z"
    assert deploy_token.expires_at == today + "T00:00:00.000Z"
    assert deploy_token.scopes == ["read_registry"]
    assert deploy_token.username == "bar"

+2 −2
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ def test_groups(gl):
            "email": "user@test.com",
            "username": "user",
            "name": "user",
            "password": "user_pass",
            "password": "E4596f8be406Bc3a14a4ccdb1df80587",
        }
    )
    user2 = gl.users.create(
@@ -18,7 +18,7 @@ def test_groups(gl):
            "email": "user2@test.com",
            "username": "user2",
            "name": "user2",
            "password": "user2_pass",
            "password": "E4596f8be406Bc3a14a4ccdb1df80587$2",
        }
    )
    group1 = gl.groups.create(
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ def test_merge_requests(project):
        }
    )

    source_branch = "branch1"
    source_branch = "branch-merge-request-api"
    project.branches.create({"branch": source_branch, "ref": "main"})

    project.files.create(
@@ -28,7 +28,7 @@ def test_merge_requests(project):
        }
    )
    project.mergerequests.create(
        {"source_branch": "branch1", "target_branch": "main", "title": "MR readme2"}
        {"source_branch": source_branch, "target_branch": "main", "title": "MR readme2"}
    )


+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ def test_create_user(gl, fixture_dir):
            "email": "foo@bar.com",
            "username": "foo",
            "name": "foo",
            "password": "foo_password",
            "password": "E4596f8be406Bc3a14a4ccdb1df80587$3",
            "avatar": open(fixture_dir / "avatar.png", "rb"),
        }
    )
Loading