piknik

Unnamed repository; edit this file 'description' to name the repository.
Info | Log | Files | Refs | README | LICENSE

commit d08471cb0cd2f4e781d7ad8d677ce008131b06a6
parent 16a1c135720f4955214628fc2af7dd5876421b1c
Author: lash <dev@holbrook.no>
Date:   Sun,  6 Nov 2022 14:31:01 +0000

Add first progress test

Diffstat:
A.gitignore | 3+++
Mpiknik/basket.py | 6+++++-
Mtest/test_basic.py | 19++++++++++++++++++-
3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,3 @@ +__pycache__ +*.pyc +build/ diff --git a/piknik/basket.py b/piknik/basket.py @@ -17,6 +17,7 @@ class Basket: def add(self, issue): self.state.put(issue.id, contents=issue) self.issues_rev[issue.id] = issue + return issue.id def get(self, issue_id): @@ -28,5 +29,8 @@ class Basket: category = self.state.BACKLOG else: category = self.state.from_name(category) - print('category {}'.format(category)) return self.state.list(category) + + + def doing(self, issue_id): + self.state.move(issue_id, self.state.DOING) diff --git a/test/test_basic.py b/test/test_basic.py @@ -27,17 +27,34 @@ class TestBasic(unittest.TestCase): def test_issue_basic(self): o = Issue('The first issue') - self.b.add(o) + v = self.b.add(o) + self.assertEqual(v, o.id) r = self.b.get(o.id) self.assertEqual(r, o) + def test_list(self): + o = Issue('The first issue') + self.b.add(o) + o = Issue('The second issue') + self.b.add(o) + r = self.b.list('backlog') + self.assertEqual(len(r), 2) + + def test_progress(self): o = Issue('The first issue') self.b.add(o) + o = Issue('The second issue') + self.b.add(o) + self.b.doing(o.id) + r = self.b.list('backlog') self.assertEqual(len(r), 1) + r = self.b.list('doing') + self.assertEqual(len(r), 1) + if __name__ == '__main__': unittest.main()