Esempio n. 1
0
 def test_write_to_log(self):
     config = GlobalConfig()
     config.set_log_path(f"{os.getcwd()}/test.txt")
     config.write_to_log("TESTING")
     with open(f"{os.getcwd()}/test.txt", "r") as f:
         self.assertEqual(f.readline(), f"{datetime.now()}: TESTING \n")
     os.remove(f"{os.getcwd()}/test.txt")
Esempio n. 2
0
 def test_set_log_path(self):
     config = GlobalConfig()
     error = False
     for x in [
             123,
             "aaaaaaaaabbbbbbbbbccccccccccc/aaaaaaaaaabbbbbbbccccccc/test.txt"
     ]:
         try:
             config.set_log_path(x)
         except AssertionError:
             error = True
     self.assertTrue(error)
     try:
         config.set_log_path(f"{os.getcwd()}/test.txt")
         error = False
     except AssertionError:
         error = True
     self.assertFalse(error)