def call_basic(self):
     """
     Invokes the filenametimestamp module with basic parameters resulting in drawers with IDs
     """
     argv = "--suppress-messages --folder " + self._tmp_dir
     memacs = FileNameTimeStamps(argv=argv.split())
     return memacs.test_get_entries()
    def test_functional(self):
        tmpfile = self.TMPFOLDER + os.sep + '2011-12-19T23.59.12_test1.txt'
        entry = "** <2011-12-19 Mon 23:59:12> [[" + tmpfile + \
            "][2011-12-19T23.59.12_test1.txt]]"

        # touch file
        open(tmpfile, 'w').close()

        argv = "-s -f " + self.TMPFOLDER
        memacs = FileNameTimeStamps(argv=argv.split())
        data = memacs.test_get_entries()

        #for d in range(len(data)):
        #    print "self.assertEqual(\n\tdata[%d],\n\t\"%s\")" % \
        #        (d, data[d])

        self.assertEqual(data[0], entry)
        self.assertEqual(data[1], "   :PROPERTIES:")
        # id changes because data_for_hashing = link
        #self.assertEqual(
        #    data[2],
        #    "   :ID:             e3b38e22498caa8812c755ec20276714a1eb1919")
        self.assertEqual(data[3], "   :END:")

        os.remove(tmpfile)
        self.assertEqual(data[0], entry, "filenametimestamps - error")
 def call_omit_drawers(self):
     """
     Invokes the filenametimestamp module with basic parameters skipping the drawers
     """
     argv = "--suppress-messages --omit-drawers --folder " + self._tmp_dir
     memacs = FileNameTimeStamps(argv=argv.split())
     return memacs.test_get_entries()
    def test_functional(self):
        tmpfile = self.TMPFOLDER + os.sep + '2011-12-19T23.59.12_test1.txt'
        entry = "** <2011-12-19 Mon 23:59:12> [[" + tmpfile + \
            "][2011-12-19T23.59.12_test1.txt]]"

        # touch file
        open(tmpfile, 'w').close()

        argv = "-s -f " + self.TMPFOLDER
        memacs = FileNameTimeStamps(argv=argv.split())
        data = memacs.test_get_entries()

        #for d in range(len(data)):
        #    print "self.assertEqual(\n\tdata[%d],\n\t\"%s\")" % \
        #        (d, data[d])

        self.assertEqual(
            data[0],
            entry)
        self.assertEqual(
            data[1],
            "   :PROPERTIES:")
        # id changes because data_for_hashing = link
        #self.assertEqual(
        #    data[2],
        #    "   :ID:             e3b38e22498caa8812c755ec20276714a1eb1919")
        self.assertEqual(
            data[3],
            "   :END:")

        os.remove(tmpfile)
        self.assertEqual(data[0], entry, "filenametimestamps - error")
    def test_functional(self):
        # touch file
        tmpfile = os.path.join(self._tmp_dir, '2011-12-19T23.59.12_test1.txt')
        with open(tmpfile, 'w'):
            pass

        entry = "** <2011-12-19 Mon 23:59> [[" + tmpfile + \
            "][2011-12-19T23.59.12_test1.txt]]"

        argv = "-s -f " + self._tmp_dir
        memacs = FileNameTimeStamps(argv=argv.split())
        data = memacs.test_get_entries()

        self.assertEqual(data[0], entry)
        self.assertEqual(data[1], "   :PROPERTIES:")
        self.assertEqual(data[3], "   :END:")
    def test_functional(self):
        # touch file
        tmpfile = os.path.join(self._tmp_dir, '2011-12-19T23.59.12_test1.txt')
        with open(tmpfile, 'w'):
            pass

        entry = "** <2011-12-19 Mon 23:59> [[" + tmpfile + \
            "][2011-12-19T23.59.12_test1.txt]]"

        argv = "-s -f " + self._tmp_dir
        memacs = FileNameTimeStamps(argv=argv.split())
        data = memacs.test_get_entries()

        self.assertEqual(data[0], entry)
        self.assertEqual(data[1], "   :PROPERTIES:")
        self.assertEqual(data[3], "   :END:")
    def test_functional_with_unusual_year(self):
        # touch file
        tmpfile = os.path.join(self._tmp_dir, '1899-12-30T00.00.00_P1000286.jpg')
        with open(tmpfile, 'w'):
            pass

        entry = "** <1899-12-30 Sat 00:00> [[" + tmpfile + \
            "][1899-12-30T00.00.00_P1000286.jpg]]"

        argv = "-s -f " + self._tmp_dir
        memacs = FileNameTimeStamps(argv=argv.split())
        data = memacs.test_get_entries()

        self.assertEqual(data[0], entry)
        self.assertEqual(data[1], "   :PROPERTIES:")
        self.assertEqual(data[3], "   :END:")
 def call_active_time_stamps(self):
     argv = "--suppress-messages --omit-drawers --folder " + self._tmp_dir
     memacs = FileNameTimeStamps(argv=argv.split())
     return memacs.test_get_entries()
 def call_skip_file_time_extraction(self):
     argv = "--skip-file-time-extraction --suppress-messages --omit-drawers --folder " + self._tmp_dir
     memacs = FileNameTimeStamps(argv=argv.split())
     return memacs.test_get_entries()