Ejemplo n.º 1
0
 def test_get_dependencies(self):
     """Test list all dependencies from POM."""
     obj = maven("""
             <project>
                 <dependencies>
                     <dependency>
                         <groupId>org.wildfly.swarm</groupId>
                         <artifactId>bom</artifactId>
                         <version>2018.5.2018.5.0</version>
                     </dependency>
                     <dependency>
                     <groupId>org.arquillian.cube</groupId>
                     <artifactId>arquillian-cube-openshift</artifactId>
                     <scope>test</scope>
                     <exclusions>
                         <exclusion>
                         <groupId>io.undertow</groupId>
                         <artifactId>undertow-core</artifactId>
                         </exclusion>
                     </exclusions>
                     </dependency>
                 </dependencies>
             </project>
             """)
     assert len(list(obj.get_dependencies())) == 2
     assert not {'org.arquillian.cube', 'org.wildfly.swarm'} - \
         {d['groupId'] for d in obj.get_dependencies()}
Ejemplo n.º 2
0
    def test_add_tags_and_value(self):
        """Test add tags and values in POM."""
        obj = maven('<project/>')
        obj['artifactId'] = 'blank-artifactId'
        obj['groupId'] = 'blank.groupId'

        assert obj['artifactId'] == 'blank-artifactId'
        assert obj['groupId'] == 'blank.groupId'
Ejemplo n.º 3
0
 def test_add_dependency(self):
     """Test add dependency in POM."""
     obj = maven('<project/>')
     dependency = {
         'groupId': 'org.wildfly.swarm',
         'artifactId': 'bom-all',
         'version': '2018.5.0',
     }
     obj.add_dependency(dependency)
     assert dependency in obj
Ejemplo n.º 4
0
 def test_attributes(self):
     """Test the content of MavenPom attributes."""
     obj = maven("""
             <project>
                 <groupId>some.groupId</groupId>
                 <artifactId>some-artifactId</artifactId>
                 <dependencies/>
             </project>
             """)
     assert obj.root is not None
     assert obj.root.groupId is not None
     assert obj.root.artifactId is not None
     assert obj.root.dependencies is not None
Ejemplo n.º 5
0
 def test_add_dependencies(self):
     """Test add dependencies in POM."""
     obj = maven('<project/>')
     dependencies = [{
         'groupId': 'org.wildfly.swarm',
         'artifactId': 'bom-all',
         'version': '2018.5.0',
     }, {
         'groupId':
         'org.arquillian.cube',
         'artifactId':
         'arquillian-cube-openshift',
         'scope':
         'test',
         'exclusions': [{
             'groupId': 'io.undertow',
             'artifactId': 'undertow-core',
         }]
     }]
     obj.add_dependencies(dependencies)
     assert all([d in obj for d in dependencies])
Ejemplo n.º 6
0
 def test_mavenpom_constructor_with_valid_xml_str(self):
     """Test the constructor for the MavenPom class with valid document."""
     obj = maven('<project/>')
     assert obj is not None
Ejemplo n.º 7
0
 def test_mavenpom_constructor_with_invalid_xml_str(self):
     """Test the constructor for the MavenPom class with invalid document."""
     with pytest.raises(etree.XMLSyntaxError):
         maven('<xml></xml> <project>')
Ejemplo n.º 8
0
 def test_mavenpom_constructor_with_blank_xml_str(self):
     """Test the constructor for the MavenPom class with blank document."""
     with pytest.raises(ValueError):
         maven('')