<commit_before>from gevent import monkey
monkey.patch_all()
from threading import Thread
import unittest
import requests
import os

from senmgr import app, db, ws

app.config["SQLALCHEMY_DATABASE_URI"] = 'sqlite:///memory'
app.config["DEBUG"] = False 
db.create_all()

Thread(target=ws.run, args=[app]).start()

class CreateSensor(unittest.TestCase):
    def test_create_sensor(self):
        data = {"sensor_key":"test_sensor_unittest"}
        r = requests.post("http://localhost:5000/sensor/register", data=data)
        self.assertEqual(r.status_code, 201)    

    def test_duplicate_sensor(self):
        data = {"sensor_key":"test_sensor_unittest"}
        r = requests.post("http://localhost:5000/sensor/register", data=data)
        self.assertEqual(r.status_code, 202)    

    def test_kill_server(self):
        requests.get("http://localhost:5000/die")

        

if __name__ == "__main__":
    unittest.main()
    
<commit_msg>checking returned val is dictionary<commit_after>from gevent import monkey
monkey.patch_all()
from threading import Thread
import unittest
import requests
import os

from senmgr import app, db, ws

app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:////tmp/unittest-db.db"
app.config["DEBUG"] = False 
db.create_all()

Thread(target=ws.run, args=[app]).start()

class CreateSensor(unittest.TestCase):
    def test_create_sensor(self):
        data = {"sensor_key":"test_sensor_unittest"}
        r = requests.post("http://localhost:5000/sensor/register", data=data)
        self.assertEqual(r.status_code, 201)    

    def test_duplicate_sensor(self):
        data = {"sensor_key":"test_sensor_unittest"}
        r = requests.post("http://localhost:5000/sensor/register", data=data)
        self.assertEqual(r.status_code, 202)    
        self.assertIsInstance(r.json(), dict)

    def test_kill_server(self):
        requests.get("http://localhost:5000/die")


if __name__ == "__main__":
    unittest.main()
{'fraction_non_alphanumeric': 0.1339835728952772, 'fraction_numerical': 0.018480492813141684, 'mean_word_length': 3.946700507614213, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '3557063', 'n_tokens_mistral': 652, 'n_tokens_neox': 614, 'n_words': 116}