You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1013 B

  1. import groovy.util.GroovyTestCase
  2. import java.net.URI
  3. import org.wikimedia.integration.PatchSet
  4. class PatchSetTest extends GroovyTestCase {
  5. void testFromZuul() {
  6. def patchset = PatchSet.fromZuul(
  7. ZUUL_URL: "ssh://foo.server:123",
  8. ZUUL_PROJECT: "foo/project",
  9. ZUUL_REF: "refs/zuul/master/Zfoo",
  10. ZUUL_COMMIT: "foosha",
  11. )
  12. assert patchset.commit == "foosha"
  13. assert patchset.project == "foo/project"
  14. assert patchset.ref == "refs/zuul/master/Zfoo"
  15. assert patchset.remote == new URI("ssh://foo.server:123/foo/project")
  16. }
  17. void testGetSCM() {
  18. def patchset = new PatchSet(
  19. commit: "foosha",
  20. project: "foo/project",
  21. ref: "refs/zuul/master/Zfoo",
  22. remote: new URI("ssh://foo.server:123/foo/project"),
  23. )
  24. def scm = patchset.getSCM()
  25. assert scm.userRemoteConfigs[0].url == "ssh://foo.server:123/foo/project"
  26. assert scm.userRemoteConfigs[0].refspec == "refs/zuul/master/Zfoo"
  27. assert scm.branches[0].name == "foosha"
  28. }
  29. }