Esempio n. 1
0
 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)
Esempio n. 2
0
 def test_set_should_append_newline(self):
     with store("cookietest", ".") as c:
         c.set("value2")
     self.assertEqual("value2\n", file("cookietest").read())
Esempio n. 3
0
 def test_set(self):
     with store("cookietest", ".") as c:
         c.set("value1\n")
     self.assertEqual("value1\n", file("cookietest").read())
Esempio n. 4
0
 def test_get_defaultvalue(self):
     with store("cookietest", ".") as c:
         self.assertEqual(u"default\n", c.get("default\n"))
Esempio n. 5
0
 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())
Esempio n. 6
0
 def test_context(self):
     with store("cookietest") as c:
         self.assert_(isinstance(c, Cookie), u"%r should be a Cookie instance" % c)