Ejemplo n.º 1
0
    def test_scanpipe_discovered_package_model_create_from_data(self):
        package = DiscoveredPackage.create_from_data(self.project1,
                                                     package_data1)
        self.assertEqual(self.project1, package.project)
        self.assertEqual("pkg:deb/debian/[email protected]?arch=all", str(package))
        self.assertEqual("deb", package.type)
        self.assertEqual("debian", package.namespace)
        self.assertEqual("adduser", package.name)
        self.assertEqual("3.118", package.version)
        self.assertEqual("arch=all", package.qualifiers)
        self.assertEqual("add and remove users and groups",
                         package.description)
        self.assertEqual("849", package.size)
        self.assertEqual("gpl-2.0 AND gpl-2.0-plus AND unknown",
                         package.license_expression)

        package_count = DiscoveredPackage.objects.count()
        missing_required_field = dict(package_data1)
        missing_required_field["name"] = ""
        self.assertIsNone(
            DiscoveredPackage.create_from_data(self.project1,
                                               missing_required_field))
        self.assertEqual(package_count, DiscoveredPackage.objects.count())
Ejemplo n.º 2
0
 def test_scanpipe_discovered_package_model_create_from_data(self):
     package = DiscoveredPackage.create_from_data(self.project1,
                                                  package_data1)
     self.assertEqual(self.project1, package.project)
     self.assertEqual("pkg:deb/debian/[email protected]?arch=all", str(package))
     self.assertEqual("deb", package.type)
     self.assertEqual("debian", package.namespace)
     self.assertEqual("adduser", package.name)
     self.assertEqual("3.118", package.version)
     self.assertEqual("arch=all", package.qualifiers)
     self.assertEqual("add and remove users and groups",
                      package.description)
     self.assertEqual("849", package.size)
     self.assertEqual("gpl-2.0 AND gpl-2.0-plus AND unknown",
                      package.license_expression)