<commit_before>import unittest

from rostam.db.sqlite import Database
from rostam.utils.constants import Settings
from rostam.utils.file_sync import read_properties_file, sync_properties


class FileSyncTest(unittest.TestCase):

    def test_read_properties_file(self):
        res = read_properties_file()
        self.assertTrue(len(res['hello world:latest']) == 4)
        self.assertEqual(res['hello world:latest']['interval'], 60)
        self.assertEqual(res['hello world:latest']['tag'], 'latest')
        self.assertEqual(res['hello world:latest']['repo'], 'https://github.com/docker-library/hello-world.git')

    def test_sync_properties(self):
        sync_properties()
        db = Database(location=Settings.BASE_FOLDER() + "rostam.db")
        res = db.db.query('select * from vcs')
        self.assertEqual(res[0]['id'], 1)
        self.assertEqual(res[0]['repo'], 'https://github.com/docker-library/hello-world.git')
        self.assertIsNone(res[0]['built_revision'])
        self.assertIsNone(res[0]['latest_revision'])
        self.assertEqual(res[0]['container_id'], 1)
        db.delete_db()

if __name__ == '__main__':
    unittest.main()<commit_msg>fixed some bugs in test<commit_after>import unittest
from os import path

from rostam.db.sqlite import Database
from rostam.utils.constants import Settings
from rostam.utils.file_sync import read_properties_file, sync_properties


class FileSyncTest(unittest.TestCase):

    def test_read_properties_file(self):
        res = read_properties_file()
        self.assertTrue(len(res['hello world:latest']) == 4)
        self.assertEqual(res['hello world:latest']['interval'], 666)
        self.assertEqual(res['hello world:latest']['tag'], 'latest')
        self.assertEqual(res['hello world:latest']['repo'], 'https://github.com/abzcoding/test.git')

    def test_sync_properties(self):
        sync_properties()
        db = Database(location=path.join(Settings.BASE_FOLDER(), "rostam.db"))
        res = db.db.query('select * from vcs')
        self.assertEqual(res[0]['id'], 1)
        self.assertEqual(res[0]['repo'], 'https://github.com/abzcoding/test.git')
        self.assertIsNone(res[0]['built_revision'])
        self.assertEqual(res[0]['container_id'], 1)
        db.delete_db()

if __name__ == '__main__':
    unittest.main()
{'fraction_non_alphanumeric': 0.14991334488734837, 'fraction_numerical': 0.008665511265164644, 'mean_word_length': 4.0747252747252745, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6469616', 'n_tokens_mistral': 717, 'n_tokens_neox': 699, 'n_words': 118}