# File Name: appunittest.py
# Date: March 3, 2017
# Description: This class is for testing write file and read file in app.py
__author__ = "Inyoung Choung"

import os
from os import path
import unittest
import app

# testing file IO
class writefiletest(unittest.TestCase):
    def runTest(self):
        # set path
        filepath = "C:\In-young Choung\Computer Programming\Self Programming Files\grocerycalc\pytest.txt"

        # create a file and write "pythontest"
        app.writefile(filepath, "pythontest")

        # read the file that is just created
        app.readfile(filepath)

        # check if the file is correctly created in the path
        self.assertTrue(str(path.isfile("pytest.txt")))

# class starter
if __name__ == '__main__':
    unittest.main()

