Fix unit test for user persistence (#5763)

* Fix unit test for user persistence

Test fails if no repo exists with key `REPO/000000000001`

* Use existing constants

* Update src/persist/zcl_abapgit_persistence_user.clas.testclasses.abap

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

Co-authored-by: Lars Hvam <larshp@hotmail.com>
Co-authored-by: abaplint[bot] <24845621+abaplint[bot]@users.noreply.github.com>
This commit is contained in:
Marc Bernard 2022-09-19 11:49:56 -04:00 committed by GitHub
parent b60007c752
commit aa1748ab28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,6 @@ CLASS ltcl_user DEFINITION
CONSTANTS:
c_abap_user TYPE sy-uname VALUE 'ABAPGIT_TEST',
c_git_user TYPE string VALUE 'abapgit_tester',
c_repo_key TYPE zif_abapgit_persistence=>ty_repo-key VALUE '000000000001',
c_repo_url TYPE string VALUE 'https://github.com/abapGit/abapGit'.
DATA:
@ -44,10 +43,17 @@ CLASS ltcl_user IMPLEMENTATION.
METHOD set_get_repo_show.
DATA: lv_key TYPE zif_abapgit_persistence=>ty_repo-key.
DATA: lv_key TYPE zif_abapgit_persistence=>ty_repo-key,
lv_repo_key TYPE zif_abapgit_persistence=>ty_repo-key.
SELECT MIN( value ) FROM (zcl_abapgit_persistence_db=>c_tabname) INTO lv_repo_key
WHERE type = zcl_abapgit_persistence_db=>c_type_repo.
IF sy-subrc <> 0.
RETURN. " can't test
ENDIF.
mi_user = zcl_abapgit_persistence_user=>get_instance( c_abap_user ).
mi_user->set_repo_show( c_repo_key ).
mi_user->set_repo_show( lv_repo_key ).
FREE mi_user.
@ -56,7 +62,7 @@ CLASS ltcl_user IMPLEMENTATION.
cl_abap_unit_assert=>assert_equals(
act = lv_key
exp = c_repo_key ).
exp = lv_repo_key ).
ENDMETHOD.