def test_sha1hash(self): c = make_system_composition('localhost') c.jvm = JVM('path', 'options') h = sha1() update_hasher(h, c.jvm.hash()) update_hasher(h, c.node_setting.hash()) self.assertEqual(c.hash(), h.hexdigest())
def hash(self): """ Return the sha1 hexdigest. Used for identifying :class:`SystemComposition` across server and client. :returns: sha1 hexdigest of instance :rtype: string """ hasher = sha1() update_hasher(hasher, self.identifier) return hasher.hexdigest()
def test_sha1sum(self): text = 'sha1 checksum test' hasher = hashlib.sha1() with NamedTemporaryFile(delete=False) as tf: write(tf, text) tf.flush() self.assertEqual(util.sha1sum(tf.name), update_hasher(hasher, text).hexdigest()) self.paths_to_delete.append(tf.name)
def hash(self): """ Return the sha1 hexdigest. Used for identifying :class:`SystemComposition` across server and client. :returns: sha1 hexdigest of instance :rtype: str """ hasher = sha1() update_hasher(hasher, self._path) update_hasher(hasher, ' '.join(self.workload.arguments) if self.workload else '') update_hasher(hasher, self._user_options) return hasher.hexdigest()
def test_unicode_hash(self): u = unicode('foo') update_hasher(self.h, u) self.assertEqual(self.h.hexdigest(), '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33')
def test_str_hash(self): s = str('foo') update_hasher(self.h, s) self.assertEqual(self.h.hexdigest(), '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33')