Example #1
0
 def command_sequence_test(self, commands, output):
     self.stealOutput()
     expected = self.strip_list(output if type(output) in (list, tuple)
                                       else [output])
     for command in commands:
         if type(command) == type(''):
             args = command.split(' ')
         else:
             args = command
         cli.execute_command_line(*cli.parse_args(args))
     self.reset()
     self.assertEqual(self.strip_list(self.out.buffer), expected)
Example #2
0
 def showTaggedSuccessTest(self, mode):
     self.stealOutput()
     (flag, spec, o) = specify_DADGAD(mode, self.db.host)
     description = cli.describe_by_mode(o)
     args = (['show', '-U', '-v', flag, spec, 'rating', '/fluiddb/about']
             + self.hostname)
     cli.execute_command_line(*cli.parse_args(args))
     self.reset()
     self.assertEqual(self.out.buffer,
             ['Object %s:' % description, '\n',
              '  /%s/rating = 10' % self.user.encode('UTF-8'), '\n',
              '  /fluiddb/about = "DADGAD"', '\n'])
     self.assertEqual(self.err.buffer, [])
Example #3
0
 def untagTest(self, mode, verbose=True):
     self.stealOutput()
     (flag, spec, o) = specify_DADGAD(mode, self.db.host)
     description = cli.describe_by_mode(o)
     flags = ['-v', flag] if verbose else [flag]
     args = ['untag'] + ['-U'] + flags + [spec, 'rating'] + self.hostname
     cli.execute_command_line(*cli.parse_args(args))
     self.reset()
     if verbose:
         target = ['Removed tag rating from object %s\n' % description,
                   '\n']
     else:
         target = []
     self.assertEqual(self.out.buffer, target)
     self.assertEqual(self.err.buffer, [])
Example #4
0
 def tagTest(self, mode, verbose=True):
     self.stealOutput()
     (flag, spec, o) = specify_DADGAD(mode, self.db.host)
     description = cli.describe_by_mode(o)
     flags = ['-v', flag] if verbose else [flag]
     args = ['tag'] + ['-U'] + flags + [spec, 'rating=10'] + self.hostname
     cli.execute_command_line(*cli.parse_args(args))
     self.reset()
     if verbose:
         target = ['Tagged object %s with rating = 10' % description, '\n']
     else:
         if mode == 'query':
             target = ['1 object matched', '\n']
         else:
             target = []
     self.assertEqual(self.out.buffer, target)
     self.assertEqual(self.err.buffer, [])