Example #1
0
 def test_add_panorama_xmp(self):
     """add_panorama_xmp - Add panorama marker to file XMP"""
     shutil.copy(test.path('img/test-no-XMP.jpg'),
                 test.path('img/test-no-xmp-temp.jpg'))
     XMP.add_panorama_xmp(test.path('img/test-no-xmp-temp.jpg'))
     self.assertTrue(
         b'GPano' in XMP.get_xmp(test.path('img/test-no-xmp-temp.jpg')))
     os.remove(test.path('img/test-no-xmp-temp.jpg'))
Example #2
0
def insert(id, name, repos, wc, setup_fn, log):
    # Checkout and commit
    tmp = os.getcwd()
    os.chdir(wc + "/..")
    run("svn", "checkout", uri("file://" + repos), output=log)
    os.chdir(id)
    step = 0
    while setup_fn(step, log):
        os.chdir(wc + "/..")
        run("svn",
            "commit",
            id,
            "-m",
            "commit step " + str(step),
            "--username",
            "test",
            output=log)
        step += 1
        os.chdir(id)
    os.chdir(tmp)

    # Create dump
    run("svnadmin", "dump", repos, output=cache_dir + "/" + name, error=log)

    # Save the module's sha-1 sum
    m = hashlib.sha224()
    f = open(test.path(id), "r")
    m.update(f.read())
    f.close()
    f = open(cache_dir + "/" + name + ".sha", "w")
    print >> f, m.hexdigest(),
    f.close()
Example #3
0
    def test_xmp_to_minidom(self):
        """xmp_to_minidom - Convert raw XMP data to minidom object"""
        xmp_raw = XMP.get_xmp(test.path('img/test-XMP.jpg'))
        xmp_minidom = XMP.xmp_to_minidom(xmp_raw)
        self.assertIsInstance(xmp_minidom, minidom.Document)

        xmp_minidom = XMP.xmp_to_minidom(b'')
        self.assertIsInstance(xmp_minidom, minidom.Document)
Example #4
0
def dirty(id, name):
    try:
        m = hashlib.sha224()
        f = open(test.path(id), "r")
        m.update(f.read())
        f.close()
        f = open(cache_dir + "/" + name + ".sha")
        digest = f.read()
        f.close()
        return (m.hexdigest() != digest)
    except:
        return True
Example #5
0
    def test_minidom_to_xmp(self):
        """minidom_to_xmp - Convert minidom object into raw XMP data"""
        xmp_raw = XMP.get_xmp(test.path('img/test-XMP.jpg'))
        xmp_minidom = XMP.xmp_to_minidom(xmp_raw)
        xmp_raw = XMP.minidom_to_xmp(xmp_minidom)
        self.assertTrue(XMP.XMP_IDENTIFIER in xmp_raw)
        self.assertTrue(XMP.XMP_PACKET_BEGIN in xmp_raw)
        self.assertTrue(XMP.XMP_PACKET_END in xmp_raw)

        xmp_minidom = XMP.xmp_to_minidom(b'')
        xmp_raw = XMP.minidom_to_xmp(xmp_minidom)
        self.assertTrue(XMP.XMP_IDENTIFIER in xmp_raw)
        self.assertTrue(XMP.XMP_PACKET_BEGIN in xmp_raw)
        self.assertTrue(XMP.XMP_PACKET_END in xmp_raw)
Example #6
0
from test import path

path()
Example #7
0
    def test_set_xmp(self):
        """set_xmp - Write XMP to file"""
        shutil.copy(test.path('img/test-no-XMP.jpg'),
                    test.path('img/test-no-xmp-temp.jpg'))
        xmp_raw = XMP.get_xmp(test.path('img/test-XMP.jpg'))
        XMP.set_xmp(test.path('img/test-no-xmp-temp.jpg'), xmp_raw)
        self.assertTrue(
            len(XMP.get_xmp(test.path('img/test-no-xmp-temp.jpg'))) > 0)
        os.remove(test.path('img/test-no-xmp-temp.jpg'))

        shutil.copy(test.path('img/test-XMP.jpg'),
                    test.path('img/test-xmp-temp.jpg'))
        self.assertTrue(
            len(XMP.get_xmp(test.path('img/test-xmp-temp.jpg'))) > 0)
        XMP.set_xmp(test.path('img/test-xmp-temp.jpg'), XMP.XMP_IDENTIFIER)
        self.assertTrue(
            XMP.get_xmp(test.path('img/test-xmp-temp.jpg')) ==
            XMP.XMP_IDENTIFIER)
        os.remove(test.path('img/test-xmp-temp.jpg'))
Example #8
0
 def test_get_xmp(self):
     """get_xmp - Retrieve existing XMP data from file"""
     self.assertEqual(XMP.get_xmp(test.path('img/test-no-XMP.jpg')), '')
     self.assertTrue(len(XMP.get_xmp(test.path('img/test-XMP.jpg'))) > 0)