Skip to content

Commit bee1196

Browse files
Add test cases
Signed-off-by: Lukasz Gryglicki <[email protected]>
1 parent 6ac1503 commit bee1196

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

cla-backend/cla/tests/unit/test_utils.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import cla
88
from cla import utils
99
from cla.models.dynamo_models import Project, Signature, User
10-
from cla.utils import (append_email_help_sign_off_content,
10+
from cla.utils import (append_email_help_sign_off_content, extract_pull_request_number,
1111
append_project_version_to_url, get_email_help_content,
1212
get_email_sign_off_content, get_full_sign_url)
1313

@@ -283,3 +283,32 @@ def test_append_project_version_to_url():
283283

284284
if __name__ == '__main__':
285285
unittest.main()
286+
287+
def test_extract_pull_request_number():
288+
tests = [
289+
["Merge pull request #232 from sun-test-org/thakurveerendras-patch-26#1\n\nUpdate README.md", 232],
290+
["Merge pull request #234 from sun-test-org/thakurveerendras-patch-26\n\nCreate mqfile2#file2", 234],
291+
["Merge pull request #235 from sun-test-org/branch#2341\n\nMQFileBranch#2342", 235],
292+
["Merge pull request #236 from sun-test-org/thakurveerendras-patch-27\n\nUpdate mqfile2#234", 236],
293+
["Merge pull request #237 from sun-test-org/thakurveerendras-patch-28#123\n\nCreate mqfile3#123", 237],
294+
["Merge pull request #235 from sun-test-org/branch#2341\n\nMQFileBranch#2342", 235],
295+
["Merge pull request #238 from sun-test-org/branch#23456\n\nPR#234567", 238],
296+
["Merge pull request #235 from sun-test-org/branch#2341\n\nMQFileBranch#2342", 235],
297+
["merge pull request #235 from sun-test-org/branch#2341\n\nMQFileBranch#2342", 235],
298+
["Hello world\nThis if for PR #123 fixing issue #112", 123],
299+
# ["Hello world\nThis if for Issue #112 - PR #123", 123],
300+
["[mdatagen] Add event type definition (#12822)\n\n#Description\n\nHello, ...", 12822],
301+
["[pt] Update localized content on content/pt/docs/languages/go/exporters.md (#6783)", 6783],
302+
["[chore]: remove testifylint-fix target (#12828)\n\n#### Description\n\ngolangci-lint is now able to apply suggested fixes from testifylint with\ngolangci-lint --fix .\nThis PR removes testifylint-fix target from Makefile.\n\nSigned-off-by: Matthieu MOREL <[email protected]>", 12828],
303+
["[chore] Prepare release 0.125.0 (#933)\n\n* Update version from 0.124.0 to 0.125.0\n\n* update versions in ebpf\n\n---------\n\nCo-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>\nCo-authored-by: Yang Song <[email protected]>", 933],
304+
["Add invoke_agent as a member of gen_ai.operation.name (#2160)", 2160],
305+
["Merge pull request #61 from open-telemetry/renovate/all-patch\n\nfix(deps): update all patch versions", 61],
306+
["Merge pull request #51 from open-telemetry/rollback-deps\n\nchore: roll back major dependency updates", 51],
307+
["fixes #6549 incorrect use of resource constructor (#6707)", 6707],
308+
["", None],
309+
["Add documentation example for xconfmap (#5675) (#12832)\n#### Description\n\nThis PR introduces a simple testable examples to the package\n[confmap](/confmap/xconfmap)", 12832]
310+
]
311+
312+
for i, (message, expected) in enumerate(tests, 1):
313+
result = extract_pull_request_number(message)
314+
assert result == expected

0 commit comments

Comments
 (0)