コード例 #1
0
ファイル: business_tests.py プロジェクト: renzon/gaebusiness
 def test_update_errors(self):
     cmd = Command()
     self.assertDictEqual({}, cmd.errors)
     errors = {'foo': 'foomsg'}
     cmd.update_errors(**errors)
     self.assertDictEqual(errors, cmd.errors)
     errors['bar'] = 'barmsg'
     cmd.update_errors(**errors)
     self.assertDictEqual(errors, cmd.errors)
コード例 #2
0
 def _to_command(self, node_or_command):
     if isinstance(node_or_command, Command):
         return node_or_command
     cmd = Command()
     try:
         node_key = to_node_key(node_or_command)
         cmd.result = node_key
     except:
         pass
     return cmd
コード例 #3
0
 def _to_command(self, node_or_command):
     if isinstance(node_or_command, Command):
         return node_or_command
     cmd = Command()
     try:
         node_key = to_node_key(node_or_command)
         cmd.result = node_key
     except:
         cmd.add_error('node', 'Invalid Node')
     return cmd
コード例 #4
0
 def _to_command(self, node_or_command):
     if isinstance(node_or_command, Command):
         return node_or_command
     cmd = Command()
     try:
         node_key = to_node_key(node_or_command)
         cmd.result = node_key
     except:
         pass
     return cmd
コード例 #5
0
def logged_user(request):
    """
    Returns a command that retrieves the current logged user based on secure cookie
    If there is no logged user, the result from command is None
    """
    dct = cookie_facade.retrive_cookie_data(request,
                                            USER_COOKIE_NAME).execute().result
    if dct is None:
        return Command()
    return NodeSearch(dct['id'])
コード例 #6
0
ファイル: business_tests.py プロジェクト: renzon/gaebusiness
def cmd_with_handle_previous_mocked():
    c = Command()
    c.handle_previous = Mock()
    return c
コード例 #7
0
 def __init__(self, name):
     Command.__init__(self, name=name)