Skip to content
Snippets Groups Projects

feat: Refactor test class and migrate tests to use commons testing package

2 unresolved threads

Resolves #76 (closed)

Edited by Zachary Sabourin

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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<>() {
  • 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.

    • Zachary Sabourin changed this line in version 3 of the diff

      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
    • I'm fine with that. I prefer everything together, especially since we have good formatting to read nesting now, but figured it would get a little too messy to put it all in one every time. I'm fine with that caveat :)

    • I think the result is pretty clean :)

    • Please register or sign in to reply
  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 406c65bf - fix: Move validation request calls to be inline

    Compare with previous version

  • Zachary Sabourin requested review from @malowe

    requested review from @malowe

  • Martin Lowe approved this merge request

    approved this merge request

  • merged

  • Martin Lowe mentioned in commit 4405eb1a

    mentioned in commit 4405eb1a

  • Please register or sign in to reply
    Loading