def test_post_writes_to_sketch(self):
        sketch = self.sketch
        handler = self.handler 

        handler.path = PREFIX + "available.json?password=secret"
        handler.data = dict(password="******")
        handler.do_GET()
        self.assertEquals(handler.response_code[0], 200)
        self.assertTrue(json.loads(handler.wfile.getvalue()))

        handler.path = PREFIX + "add"
        handler.test_password='******'
        handler.do_POST()
        self.assertEquals(handler.response_code[0], 201)

        handler = PasswordOracleRequestHandlerCrashDummy(
            sketch, 
            language_model.compile(StringIO.StringIO("aaa\naab\nabb\naaa")))

        handler.path = PREFIX + "available.json?password=secret"
        handler.do_GET()
        self.assertFalse(json.loads(handler.wfile.getvalue()))
    def setUp(self):
        self.sketch = deprecating_sketch.DeprecatingSketch(slots=100, items=2, per_item=1)

        self.handler = PasswordOracleRequestHandlerCrashDummy(
            self.sketch, 
            language_model.compile(StringIO.StringIO("aaa\naab\nabb\naaa")))