class TestGateCommand(BaseTest):

    def setUp(self):
        self.command = CommandSomethingElse(MultiDict({'what': ['whatever']}))

    def test_execute(self):
        self.eq(self.command.execute(), None)
        self.eq(self.command.result, {'this': {'is': ['response', 'long']}})

    def test_set_result(self):
        self.command.set_result(['result'])
        self.eq(self.command.result, ['result'])

    def test_pretty(self):
        data = {'result': ['1', '2', {'3': [4, 5]}]}
        self.command.set_result(data)
        self.eq(self.command.pretty(),
                json.dumps(data, sort_keys=True, indent=4,
                           separators=(',', ': ')))

    def test_pretty_datetime(self):
        data = {'d': datetime.now()}
        self.command.set_result(data)
        self.eq(self.command.pretty(),
                '{\n    "d": "%s"\n}' % data['d'].isoformat())

    def test_pretty_date(self):
        data = {'d': date.today()}
        self.command.set_result(data)
        self.eq(self.command.pretty(),
                '{\n    "d": "%s"\n}' % data['d'].isoformat())

    def test_pretty_russian(self):
        data = {'name': 'Иван'}
        self.command.set_result(data)
        self.eq(self.command.pretty(),
                unicode('{\n    "name": "Иван"\n}', 'utf8'))

    def test_pretty_unicode(self):
        self.true(type(self.command.pretty()), unicode)
 def setUp(self):
     self.command = CommandSomethingElse(MultiDict({'what': ['whatever']}))