abapGit/src/git_platform/zcl_abapgit_git_url.clas.testclasses.abap
Lars Hvam 20c714889f
ZCL_ABAPGIT_GIT_URL, remove repo usage (#4225)
* ZCL_ABAPGIT_GIT_URL, remove repo usage

https://github.com/abapGit/abapGit/issues/2127#issuecomment-732262897, first part of C

* Update zcl_abapgit_git_url.clas.testclasses.abap

* Update src/git_platform/zcl_abapgit_git_url.clas.testclasses.abap

Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>

Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>
2020-11-24 08:00:36 +01:00

58 lines
2.2 KiB
ABAP

CLASS ltcl_repo_online DEFINITION DEFERRED.
CLASS zcl_abapgit_git_url DEFINITION LOCAL FRIENDS ltcl_repo_online.
CLASS ltcl_repo_online DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
METHODS:
test_repo_commit_show_urls FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS ltcl_repo_online IMPLEMENTATION.
METHOD test_repo_commit_show_urls.
TYPES: BEGIN OF ty_show_url_test,
repo_url TYPE string,
show_url TYPE string,
END OF ty_show_url_test,
ty_show_url_tests TYPE STANDARD TABLE OF ty_show_url_test WITH DEFAULT KEY.
DATA: ls_provider_urls TYPE ty_show_url_test,
lt_test_urls TYPE ty_show_url_tests,
lv_testhash TYPE zif_abapgit_definitions=>ty_sha1 VALUE 'my-SHA1-hash',
lo_cut TYPE REF TO zcl_abapgit_git_url,
lv_show_url TYPE zif_abapgit_persistence=>ty_repo-url.
FIELD-SYMBOLS <ls_provider_urls> TYPE ty_show_url_test.
CREATE OBJECT lo_cut.
ls_provider_urls-repo_url = |https://github.com/abapGit/abapGit.git|.
ls_provider_urls-show_url = |https://github.com/abapGit/abapGit/commit/{ lv_testhash }|.
APPEND ls_provider_urls TO lt_test_urls.
ls_provider_urls-repo_url = |http://github.com/abapGit/abapGit.git|.
ls_provider_urls-show_url = |http://github.com/abapGit/abapGit/commit/{ lv_testhash }|.
APPEND ls_provider_urls TO lt_test_urls.
ls_provider_urls-repo_url = |https://bitbucket.org/abapGit/abapGit.git|.
ls_provider_urls-show_url = |https://bitbucket.org/abapGit/abapGit/commits/{ lv_testhash }|.
APPEND ls_provider_urls TO lt_test_urls.
ls_provider_urls-repo_url = |https://gitlab.com/abapGit/abapGit.git|.
ls_provider_urls-show_url = |https://gitlab.com/abapGit/abapGit/-/commit/{ lv_testhash }|.
APPEND ls_provider_urls TO lt_test_urls.
LOOP AT lt_test_urls ASSIGNING <ls_provider_urls>.
lv_show_url = lo_cut->get_default_commit_display_url(
iv_repo_url = <ls_provider_urls>-repo_url
iv_hash = lv_testhash ).
cl_abap_unit_assert=>assert_equals(
exp = <ls_provider_urls>-show_url
act = lv_show_url ).
ENDLOOP.
ENDMETHOD.
ENDCLASS.