30 lines
875 B
Python
Executable file
30 lines
875 B
Python
Executable file
#!/usr/bin/python3
|
|
|
|
import newfol.database
|
|
|
|
import os
|
|
import subprocess
|
|
import tempfile
|
|
import unittest
|
|
|
|
class TestGitTransactions(unittest.TestCase):
|
|
def setUp(self):
|
|
self.tempdir = tempfile.TemporaryDirectory()
|
|
fp = open(self.tempdir.name + "/schema", "w")
|
|
print("fmt:0:newfol schema file", file=fp)
|
|
print("txn:git", file=fp)
|
|
fp.close()
|
|
def test_all_checked_in(self):
|
|
db = newfol.database.Database.load(self.tempdir.name)
|
|
db.store()
|
|
curdir = os.getcwd()
|
|
os.chdir(self.tempdir.name)
|
|
output = ""
|
|
with subprocess.Popen(["git", "status", "--porcelain"],
|
|
stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) as proc:
|
|
output = proc.stdout.read()
|
|
os.chdir(curdir)
|
|
self.assertEqual(output, b"")
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|