예제 #1
0
파일: commands.py 프로젝트: rodo/pyrede
    def test_update(self):
        """
        Test when a package will be update

        TestServer contains 2 packages, one is 'python-dikbm-adapter'
        """
        pack = Package.objects.create(
            name="python-dikbm-adapter",
            latest_version="0.0.1",
            link="http://www.foo.bar",
            description="lorem ipsum",
            last_update=datetime.now(),
        )

        PackageVersion.objects.create(
            package=pack,
            version="0.0.1",
            link="http://www.foo.bar",
            description="lorem ipsum",
            pubdate=datetime.today(),
        )

        http = TestServer()
        http.start()
        url = "http://127.0.0.1:%d/rss" % (http.port)

        call_command("import_latest", url)

        nb_pack = Package.objects.all().count()
        nb_ver = PackageVersion.objects.all().count()

        self.assertEqual(nb_pack, 2)
        self.assertEqual(nb_ver, 3)
예제 #2
0
파일: commands.py 프로젝트: rodo/pyrede
    def test_import_latest(self):
        """
        Create a Package
        """
        http = TestServer()
        http.start()
        url = "http://127.0.0.1:%d/rss" % (http.port)

        call_command("import_latest", url)

        nb_pack = Package.objects.all().count()

        self.assertEqual(nb_pack, 2)
        self.assertEqual(PackageVersion.objects.all().count(), 2)