Esempio n. 1
0
 def test_get_path_for_artifact(self):
     """
     The default archive policy should return the path from the artifact
     url.
     """
     artifact = ArtifactFactory.create(filename="testing.img")
     policy = DefaultPolicy()
     self.assertEqual(
         "testing.img", policy.get_path_for_artifact(artifact))
Esempio n. 2
0
    def test_get_path_for_artifact(self):
        """
        The default archive policy should return the path from the artifact
        url.
        """
        dependency = DependencyFactory.create(name="My Dependency")
        build = BuildFactory.create(job=dependency.job)
        artifact = ArtifactFactory.create(filename="testing.img", build=build)

        policy = DefaultPolicy()

        timestamp = "%s-%s" % (build.created_at.strftime("%Y-%m-%d"),
                               time.mktime(build.created_at.timetuple()))
        self.assertEqual(
            "my-dependency/%s/testing.img" % timestamp,
            policy.get_path_for_artifact(artifact,
                                         dependency=dependency,
                                         build=build))
Esempio n. 3
0
    def test_get_path_for_artifact(self):
        """
        The default archive policy should return the path from the artifact
        url.
        """
        dependency = DependencyFactory.create(name="My Dependency")
        build = BuildFactory.create(job=dependency.job)
        artifact = ArtifactFactory.create(
            filename="testing.img", build=build)

        policy = DefaultPolicy()

        timestamp = "%s-%s" % (
            build.created_at.strftime("%Y-%m-%d"),
            time.mktime(build.created_at.timetuple()))
        self.assertEqual(
            "my-dependency/%s/testing.img" % timestamp,
            policy.get_path_for_artifact(
                artifact, dependency=dependency, build=build))