Ejemplo n.º 1
0
 def test_to_dict(self) -> None:
     repo = MagicMock(ref="ref", url="repo")
     repo.output.return_value = "version=2.1"
     component = ComponentOpenSearch("common-utils", repo, "1.1.0")
     self.assertEqual(
         component.to_dict(),
         {"name": "common-utils", "ref": "ref", "repository": "repo"},
     )
 def test_gradle_cmd_props(self):
     self.assertEqual(
         ComponentOpenSearch.gradle_cmd("properties", {
             "build.snapshot": "false",
             "opensearch.version": "1.0"
         }),
         "./gradlew properties -Dbuild.snapshot=false -Dopensearch.version=1.0",
     )
Ejemplo n.º 3
0
 def properties(self) -> PropertiesFile:
     cmd = ComponentOpenSearch.gradle_cmd(
         "properties", {"build.snapshot": str(self.snapshot).lower()})
     return PropertiesFile(self.git_repo.output(cmd))
Ejemplo n.º 4
0
 def test_gradle_cmd_prop(self) -> None:
     self.assertEqual(
         ComponentOpenSearch.gradle_cmd("properties", {"build.snapshot": "false"}),
         "./gradlew properties -Dbuild.snapshot=false",
     )
Ejemplo n.º 5
0
 def test_gradle_cmd_target(self) -> None:
     self.assertEqual(ComponentOpenSearch.gradle_cmd("properties"), "./gradlew properties")
Ejemplo n.º 6
0
 def test_properties(self) -> None:
     repo = MagicMock()
     repo.output.return_value = "version=2.1"
     component = ComponentOpenSearch("common-utils", repo, "1.1.0")
     self.assertEqual(component.properties.get_value("version"), "2.1")
Ejemplo n.º 7
0
 def test_checkout(self, *mocks: MagicMock) -> None:
     component = ComponentOpenSearch.checkout("common-utils", "path", "1.1.0")
     self.assertEqual(component.name, "common-utils")
     self.assertFalse(component.snapshot)
 def publish_to_maven_local(self):
     cmd = ComponentOpenSearch.gradle_cmd("publishToMavenLocal", {"build.snapshot": str(self.snapshot).lower()})
     self.git_repo.execute_silent(cmd)
 def test_version(self):
     repo = MagicMock()
     repo.output.return_value = "version=2.1"
     component = ComponentOpenSearch("common-utils", repo, "1.1.0")
     self.assertEqual(component.version, "2.1")