def testLogfileNotExists(self): """Test start of quit store without logfile.""" args = quitApp.parseArgs( ['-c', self.localConfigFile, '-cm', 'localconfig']) quitApp.initialize(args) self.assertFalse(os.path.isfile(self.logfile))
def testGitLog(self): """Test /git/log API request.""" args = quitApp.parseArgs( ['-c', self.localConfigFile, '-cm', 'localconfig']) quitApp.initialize(args) response = self.app.get('/git/log') self.assertEqual(response.status, '200 OK')
def testStartApp(self): """Test start of quit store.""" args = quitApp.parseArgs( ['-c', self.localConfigFile, '-cm', 'localconfig']) quitApp.initialize(args) query = "SELECT * WHERE {graph ?g {?s ?p ?o .}}" response = self.app.post('/sparql', data=dict(query=query)) self.assertEqual(response.status, '200 OK')
def testGCConfiguration(self): """Test Garbage Collection configuration.""" args = quitApp.parseArgs(['-c', self.localConfigFile, '-gc']) quitApp.initialize(args) with subprocess.Popen(["git", "config", "gc.auto"], stdout=subprocess.PIPE, cwd=self.local) as getGCAuto: stdout, stderr = getGCAuto.communicate() response = stdout.decode("UTF-8").strip() self.assertNotEqual(response, '') self.assertEqual(response, '256')
def testLogfileExists(self): """Test start of quit store with logfile.""" self.assertFalse(os.path.isfile(self.logfile)) args = quitApp.parseArgs([ '-c', self.localConfigFile, '-cm', 'localconfig', '-l', self.logfile ]) quitApp.initialize(args) self.assertTrue(os.path.isfile(self.logfile)) self.assertNotEqual(stat(self.logfile).st_size, 0) infomsg = 'QuitStore successfully running.' check = False with open(self.logfile) as logFile: if infomsg in logFile.read(): check = True self.assertTrue(check)