def test_setting_the_same_value_should_not_change_mtime(self): with file("cookietest", "w") as f: print >> f, u"value3" before = os.stat("cookietest").st_mtime with store("cookietest", ".") as c: c.set(c.get()) self.assertEqual(os.stat("cookietest").st_mtime, before)
def test_set_should_append_newline(self): with store("cookietest", ".") as c: c.set("value2") self.assertEqual("value2\n", file("cookietest").read())
def test_set(self): with store("cookietest", ".") as c: c.set("value1\n") self.assertEqual("value1\n", file("cookietest").read())
def test_get_defaultvalue(self): with store("cookietest", ".") as c: self.assertEqual(u"default\n", c.get("default\n"))
def test_get(self): with file("cookietest", "w") as f: print >> f, u"value" with store("cookietest", ".") as c: self.assertEqual(u"value\n", c.get())
def test_context(self): with store("cookietest") as c: self.assert_(isinstance(c, Cookie), u"%r should be a Cookie instance" % c)