feat: Refactor test class and migrate tests to use commons testing package
Resolves #76 (closed)
Merge request reports
Activity
@malowe :)
Needs release of most recent testing package changes to build properly in Jenkins. Then I'll update the POM
82 */ 83 public static final GitUser BOT_PROJBOT = GitUser.builder().setName("projbot").setMail("1.bot@eclipse.org") 84 .build(); 85 public static final GitUser BOT_PROJ_GH = GitUser.builder().setName("protobot-gh") 86 .setMail("2.bot-github@eclipse.org").build(); 87 public static final GitUser BOT_PROTOBOT = GitUser.builder().setName("protobot").setMail("2.bot@eclipse.org") 88 .build(); 89 public static final GitUser BOT_PROTO_GH = GitUser.builder().setName("protobot-gh") 90 .setMail("2.bot-github@eclipse.org").build(); 91 public static final GitUser BOT_SPECBOT = GitUser.builder().setName("specbot").setMail("3.bot@eclipse.org") 92 .build(); 93 94 /* 95 * BODY PARAMS 96 */ 97 private static final Map<String, Object> SUCCESS_BODY_PARAMS = new HashMap<>() { changed this line in version 3 of the diff
378 .setParents(Arrays.asList("46bb69bf6aa4ed26b2bf8c322ae05bef0bcc5c10")).build(); 379 commits.add(c1); 380 vr = ValidationRequest.builder().setStrictMode(false).setProvider(ProviderType.GITHUB) 381 .setRepoUrl(new URI("http://www.github.com/eclipsefdn/tck-proto")).setCommits(commits) 382 .build(); 317 Commit c1 = createStandardUsercommit(USER_GRUNTS, USER_GRUNTS); 318 319 vr = createGitHubRequest(false, "http://www.github.com/eclipsefdn/tck-proto", Arrays.asList(c1)); 383 320 384 // test output w/ assertions 385 321 // Should be invalid as Grunt does not have spec project write access 386 322 // Should have 2 errors, as both users get validated 323 Map<String, Object> bodyParams = new HashMap<>(FAIL_DOUBLE_ERR_BODY_PARAMS); 324 bodyParams.put("commits." + c1.getHash() + ".errors[0].code", APIStatusCode.ERROR_SPEC_PROJECT.getValue()); 325 326 EndpointTestCase t1 = TestCaseHelper.prepareSuccessCase(ECA_BASE_URL, new String[] {}, "") We can combine t1 into line below as we don't use this var again. To make it a little more useable, WDYT about the following convention:
If we use a testcase once with no references to var, create it inline with the templates call. Bodies of requests can be kept separate from template call to make it a little cleaner to maintain.
changed this line in version 3 of the diff
I agree and I've changed it in my latest commit. I think it would make sense to do the same to the various
vr
variables scattered throughout. I would only do this to template calls that use the static test cases. As otherwise it would make it too difficult to read. WDYT?Edited by Zachary Sabourin
added 1 commit
- 406c65bf - fix: Move validation request calls to be inline
requested review from @malowe
mentioned in commit 4405eb1a