def test_success_unqualified_sigset(self): dst = tempname(10) ret = I_find_signature(I_SIGFILE_TYPE_SIGSET, dst, self.mapset_name) self.assertFalse(ret) ret = I_find_signature(I_SIGFILE_TYPE_SIGSET, self.src_sigset, self.src_mapset_name) self.assertTrue(ret) ret = I_signatures_copy(I_SIGFILE_TYPE_SIGSET, self.src_sigset, self.src_mapset_name, dst) self.sigdirs.append(f"{self.mpath}/signatures/sigset/{dst}") self.assertEqual(ret, 0) ret = I_find_signature(I_SIGFILE_TYPE_SIGSET, dst, self.mapset_name) self.assertTrue(ret) ms = utils.decode(ret) self.assertEqual(ms, self.mapset_name) self.assertTrue( os.path.isfile(f"{self.mpath}/signatures/sigset/{dst}/sig"))
def test_success_fq_sig(self): dst_name = tempname(10) self.sigdirs.append(f"{self.mpath}/signatures/sig/{dst_name}") dst = dst_name + "@" + self.mapset_name ret = I_find_signature(I_SIGFILE_TYPE_SIG, dst, self.mapset_name) self.assertFalse(ret) ret = I_find_signature(I_SIGFILE_TYPE_SIG, self.src_sig, self.src_mapset_name) self.assertTrue(ret) ret = I_signatures_copy( I_SIGFILE_TYPE_SIG, self.src_sig + "@" + self.src_mapset_name, self.src_mapset_name, dst, ) self.assertEqual(ret, 0) ret = I_find_signature(I_SIGFILE_TYPE_SIG, dst, self.mapset_name) self.assertTrue(ret) ms = utils.decode(ret) self.assertEqual(ms, self.mapset_name) self.assertTrue( os.path.isfile(f"{self.mpath}/signatures/sig/{dst_name}/sig"))
def test_sigset_does_not_exist(self): ret = I_signatures_copy(I_SIGFILE_TYPE_SIGSET, tempname(10), self.mapset_name, tempname(10)) self.assertEqual(ret, 1)
def test_copy_to_wrong_mapset(self): rnd_name = "{0}@{0}".format(tempname(10)) ret = I_signatures_copy(I_SIGFILE_TYPE_SIG, tempname(10), self.mapset_name, rnd_name) self.assertEqual(ret, 1)