piknik

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

test_tag.py (1010B)


      1 # standard imports
      2 import unittest
      3 import logging
      4 
      5 # external imports
      6 import shep
      7 
      8 # local imports
      9 from piknik import (
     10         Basket,
     11         Issue,
     12         )
     13 from piknik.error import DeadIssue
     14 
     15 # tests imports
     16 from tests.common import debug_out
     17 from tests.common import TestStates
     18 
     19 logging.basicConfig(level=logging.DEBUG)
     20 logg = logging.getLogger()
     21 
     22 
     23 def debug_out(self, k, v):
     24     logg.debug('TRACE: {} {}'.format(k, v))
     25 
     26 
     27 class TestBasic(unittest.TestCase):
     28 
     29     def setUp(self):
     30         self.b = Basket(TestStates())
     31 
     32 
     33     def test_setget(self):
     34         o = Issue('foo')
     35         v = self.b.add(o)
     36         self.b.tag(v, 'inky')
     37         self.b.tag(v, 'pinky')
     38         self.b.untag(v, 'pinky')
     39 
     40 
     41     def test_setget_alias(self):
     42         o = Issue('foo', alias='bar')
     43         v = self.b.add(o)
     44         self.b.tag('bar', 'inky')
     45         self.b.tag('bar', 'pinky')
     46         self.b.untag('bar', 'pinky')
     47         self.assertEqual(self.b.tags('bar'), ['INKY']) 
     48 
     49 
     50  
     51 if __name__ == '__main__':
     52     unittest.main()