~ubuntu-branches/ubuntu/maverick/yokadi/maverick

« back to all changes in this revision

Viewing changes to src/yokadi/tests/projecttestcase.py

  • Committer: Bazaar Package Importer
  • Author(s): Harald Sitter
  • Date: 2009-07-19 13:01:35 UTC
  • Revision ID: james.westby@ubuntu.com-20090719130135-eonczddb1s21ux1v
Tags: upstream-0.10.0
Import upstream version 0.10.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: UTF-8 -*-
 
2
"""
 
3
Project test cases
 
4
@author: Aurélien Gâteau <aurelien.gateau@free.fr>
 
5
@license: GPLv3
 
6
"""
 
7
 
 
8
import unittest
 
9
 
 
10
import testutils
 
11
 
 
12
from db import Project
 
13
from projectcmd import ProjectCmd
 
14
import tui
 
15
 
 
16
class ProjectTestCase(unittest.TestCase):
 
17
    def setUp(self):
 
18
        testutils.clearDatabase()
 
19
        self.cmd = ProjectCmd()
 
20
 
 
21
 
 
22
    def testAdd(self):
 
23
        tui.addInputAnswers("y")
 
24
        self.cmd.do_p_add("p1")
 
25
 
 
26
        tui.addInputAnswers("y", "y")
 
27
        self.cmd.do_p_add("p2 @kw1 @kw2=12")
 
28
 
 
29
        projects = list(Project.select())
 
30
        result = [x.name for x in projects]
 
31
        expected = [u"p1", u"p2"]
 
32
        self.assertEqual(result, expected)
 
33
 
 
34
        kwDict = Project.get(2).getKeywordDict()
 
35
        self.assertEqual(kwDict, dict(kw1=None, kw2=12))
 
36
 
 
37
# vi: ts=4 sw=4 et