@@ -0,0 +1,1075 @@
+import os%0Afrom unittest import TestCase%0A%0Afrom quilt.db import Db, Patch%0Afrom quilt.error import QuiltError%0Aimport quilt.refresh%0Afrom quilt.utils import TmpDirectory%0A%0Aclass Test(TestCase):%0A%0A    def test_refresh(self):%0A        with TmpDirectory() as dir:%0A            old_dir = os.getcwd()%0A            try:%0A                os.chdir(dir.get_name())%0A                db = Db(%22.pc%22)%0A                db.create()%0A                backup = os.path.join(%22.pc%22, %22patch%22)%0A                os.mkdir(backup)%0A                with open(os.path.join(backup, %22file%22), %22wb%22) as backup:%0A                    pass%0A                db.add_patch(Patch(%22patch%22))%0A                db.save()%0A                with open(%22patch%22, %22wb%22) as file:%0A                    pass%0A                with open(%22file%22, %22wb%22) as file:%0A                    file.write(b%22added%5Cn%22)%0A                cmd = quilt.refresh.Refresh(%22.%22, %22.pc%22, %22.%22)%0A                cmd.refresh()%0A                with open(%22patch%22, %22r%22) as patch:%0A                    self.assertTrue(patch.read(30))%0A            finally:%0A                os.chdir(old_dir)%0A

Test the refresh operation