Пример #1
0
 def test_update_item(self):
     builder = EnvironBuilder(method='POST', data={'id': 'idea-1', 'name':'updated name', 'description':'new description', 'bla':'bli'})
     env = builder.get_environ()
     request = Request(env)
             
     idea = Idea(ItemType('idea', ''), 'idea-1', 'idea-1')
     self.gui.update_item(request, idea)
             
     assert idea.get_name() == 'updated name'
     assert idea.get_description() == 'new description'
Пример #2
0
 def test_create_or_update_item_existing(self):
     self.sodocu.save_item.return_value = True
     idea = Idea(ItemType('idea', ''), 'idea-1', 'idea-1')
     self.sodocu.get_item_by_id.return_value = idea
            
     builder = EnvironBuilder(method='POST', data={'id': 'idea-1', 'name':'updated name', 'description':'new description', 'bla':'bli'})
     env = builder.get_environ()
     request = Request(env)
             
     self.gui.create_or_update_item(request, 'idea', 'idea-1')
     assert idea.get_name() == 'updated name'
     assert idea.get_description() == 'new description'