Пример #1
0
def test_earlier_start():
    act = get_base()
    matches = Activity.locate(act.start - timedelta(days=2), datetime.now(), ["Working on tic"])
    eq_(2, len(matches))
    assert act.key() in set((m.key() for m in matches))
Пример #2
0
def test_case_insensitive():
    act = get_base()
    matches = Activity.locate(act.start, datetime.now(), ["working"])
    eq_(1, len(matches))
Пример #3
0
def test_same_ending():
    act = get_base()
    matches = Activity.locate(act.start, datetime.now(), ["on tic"])
    eq_(2, len(matches))
    assert act.key() in set((m.key() for m in matches))
Пример #4
0
def test_single_letter_difference():
    act = get_base()
    matches = Activity.locate(act.start, datetime.now(), ["Working"])
    eq_(1, len(matches))
    eq_(act.key(), iter(matches).next().key())
Пример #5
0
def test_tag():
    act = get_base()
    matches = Activity.locate(tags=["tic"])
    eq_(3, len(matches))
    assert act.key() in set((m.key() for m in matches))
Пример #6
0
 def tearDown(self):
     self.data.teardown()
     for a in Activity.all():
         a.delete()
     for p in UserPrefs.all():
         p.delete()
Пример #7
0
 def testEditDuration(self):
     self.act.stop = datetime.now()
     self.act.put()
     newstop = self.act.start + timedelta(hours=1)
     self.app.post("/activity/duration", {"key": self.key, 'value':"1 hours"})
     eq_(newstop, Activity.get(self.key).stop)
Пример #8
0
 def testRemoveTags(self):
     response = self.app.post("/activity/tags", {'key': self.key, 'value':''})
     eq_([], Activity.get(self.key).tags)
Пример #9
0
 def testAddTags(self):
     response = self.app.post("/activity/tags", {'key': self.key, 'value':'new tag values'})
     eq_(['new', 'tag', 'values'], Activity.get(self.key).tags)
Пример #10
0
 def testAgain(self):
     response = self.app.post("/activity/again", {'key': self.key})
     response.mustcontain("true", self.act.name)
     assert Activity.all().filter("user ="******"name =", self.act.name).count() == 3
Пример #11
0
 def testRename(self):
     response = self.app.post("/activity/rename", {'key': self.key, 'value':'new name'})
     assert Activity.get(self.key).name == "new name"
Пример #12
0
 def testRestart(self):
     self.act.stop = datetime.now()
     self.act.put()
     response = self.app.post("/activity/restart", {'key': self.key})
     response.mustcontain("true", self.act.name)
     assert Activity.get(self.key).stop is None
Пример #13
0
 def testStop(self):
     assert self.act.stop is None
     response = self.app.post('/activity/stop', {'key': self.key})
     response.mustcontain("true", self.act.name)
     assert Activity.get(self.key) is not None
Пример #14
0
 def testDelete(self):
     response = self.app.post('/activity/delete', {'key': self.key})
     response.mustcontain("true")
     assert Activity.get(self.key) is None
     response = self.app.post('/activity/delete')
     response.mustcontain("false", "key must be given")
Пример #15
0
def test_multiple_names():
    act = get_base()
    matches = Activity.locate(act.start, datetime.now(), ["Working", "Horking"])
    eq_(2, len(matches))
Пример #16
0
 def testEditStart(self):
     newstart = datetime(2008, 9, 17, 12, 15)
     self.app.post("/activity/start",
             {'key': self.key, 'value':newstart.strftime("%Y/%m/%d %H:%M")})
     eq_(newstart, Activity.get(self.key).start)
Пример #17
0
def test_single_letter_missing():
    act = get_base()
    matches = Activity.locate(act.start, datetime.now(), ["orking"])
    eq_(0, len(matches))
Пример #18
0
 def testLocalstart(self):
     pref = prefs()
     pref.tzname = "US/Pacific"
     pref.put()
     eq_("US/Pacific", Activity.all()[0].localstart.tzinfo.zone)