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, [])
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, [])
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, [])