-
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This will require that any project that is new to have a license in the pom for every released version. This allows existing projects (ones that had a version released before the boundary date) to continue to deploy versions without licenses, but only if the most recent release did not have a license. If the project has a license, it must continue to provide one. We will remove that in the future after giving ample notice, at which point every deploy must have a license.
- Loading branch information
Showing
8 changed files
with
161 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.clojars.dantheman</groupId> | ||
<artifactId>test</artifactId> | ||
<version>0.0.1</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>asdf</name> | ||
<url>https://example.org</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.clojure</groupId> | ||
<artifactId>clojure</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
[clojars.file-utils :as fu] | ||
[clojars.http-utils :refer [clear-sessions!]] | ||
[clojars.integration.steps :refer [create-deploy-token login-as register-as]] | ||
[clojars.routes.repo :as repo] | ||
[clojars.s3 :as s3] | ||
[clojars.test-helper :as help] | ||
[clojars.web.common :as common] | ||
|
@@ -582,6 +583,86 @@ | |
;; This test throws on failure, so we have this assertion to satisfy kaocha | ||
(is true)) | ||
|
||
(deftest new-project-must-include-license | ||
(-> (session (help/app)) | ||
(register-as "dantheman" "[email protected]" "password")) | ||
(let [token (create-deploy-token (session (help/app)) "dantheman" "password" "testing")] | ||
(is (thrown-with-msg? | ||
DeploymentException | ||
#"Forbidden - the POM file does not include a license" | ||
(deploy | ||
{:coordinates '[org.clojars.dantheman/test "0.0.1"] | ||
:jar-file (io/file (io/resource "test.jar")) | ||
:pom-file (io/file (io/resource "test-0.0.1/test-no-license.pom")) | ||
:password token}))) | ||
|
||
(help/match-audit {:username "dantheman"} | ||
{:user "dantheman" | ||
:group_name "org.clojars.dantheman" | ||
:jar_name "test" | ||
:version "0.0.1" | ||
:message "the POM file does not include a license. See https://bit.ly/3PQunZU" | ||
:tag "missing-license"}))) | ||
|
||
(deftest existing-project-with-no-license-does-not-require-license | ||
(-> (session (help/app)) | ||
(register-as "dantheman" "[email protected]" "password")) | ||
(let [token (create-deploy-token (session (help/app)) "dantheman" "password" "testing")] | ||
;; Deploy a version with no license with license check disabled so we can | ||
;; get this project in a legacy state | ||
(with-redefs [repo/validate-pom-license (constantly true)] | ||
(deploy | ||
{:coordinates '[org.clojars.dantheman/test "0.0.1"] | ||
:jar-file (io/file (io/resource "test.jar")) | ||
:pom-file (io/file (io/resource "test-0.0.1/test-no-license.pom")) | ||
:password token})) | ||
|
||
;; Deploy a new version that doesn't have a license | ||
(deploy | ||
{:coordinates '[org.clojars.dantheman/test "0.0.2"] | ||
:jar-file (io/file (io/resource "test.jar")) | ||
:pom-file (help/rewrite-pom (io/file (io/resource "test-0.0.1/test-no-license.pom")) | ||
{:version "0.0.2"}) | ||
:password token}) | ||
|
||
(help/match-audit {:username "dantheman"} | ||
{:user "dantheman" | ||
:group_name "org.clojars.dantheman" | ||
:jar_name "test" | ||
:version "0.0.2" | ||
:tag "deployed"}))) | ||
|
||
(deftest project-that-had-license-for-most-recent-release-must-provide-license | ||
(-> (session (help/app)) | ||
(register-as "dantheman" "[email protected]" "password")) | ||
(let [token (create-deploy-token (session (help/app)) "dantheman" "password" "testing")] | ||
;; Deploy a version with a license | ||
(deploy | ||
{:coordinates '[org.clojars.dantheman/test "0.0.1"] | ||
:jar-file (io/file (io/resource "test.jar")) | ||
:pom-file (io/file (io/resource "test-0.0.1/test.pom")) | ||
:password token}) | ||
|
||
;; Deploy a new version that doesn't have a license | ||
(is (thrown-with-msg? | ||
DeploymentException | ||
#"Forbidden - the POM file does not include a license" | ||
(deploy | ||
{:coordinates '[org.clojars.dantheman/test "0.0.2"] | ||
:jar-file (io/file (io/resource "test.jar")) | ||
:pom-file (help/rewrite-pom (io/file (io/resource "test-0.0.1/test-no-license.pom")) | ||
{:version "0.0.2"}) | ||
:password token}))) | ||
|
||
(help/match-audit {:username "dantheman"} | ||
{:user "dantheman" | ||
:group_name "org.clojars.dantheman" | ||
:jar_name "test" | ||
:version "0.0.2" | ||
:message "the POM file does not include a license. See https://bit.ly/3PQunZU" | ||
:tag "missing-license"}))) | ||
|
||
|
||
(deftest user-can-deploy-new-version-in-same-session | ||
(-> (session (help/app)) | ||
(register-as "dantheman" "[email protected]" "password")) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters