Exemplo n.º 1
0
    def command(self):
        super(CkanCommand, self).command()

        if len(self.args) < 2:
            CkanCommand.parser.print_help()
            return 1

        from openspending.lib import ckan

        self.c = ckan.get_client()

        cmd = self.args[0]

        if cmd == 'show':
            self._cmd_show()
        elif cmd == 'check':
            self._cmd_check()
        elif cmd == 'hintadd':
            self._cmd_hintadd()
        elif cmd == 'hintrm':
            self._cmd_hintrm()
        else:
            raise self.BadCommand("Subcommand '%s' not recognized " \
                                  "by 'ckan' command!" % cmd)
Exemplo n.º 2
0
    def test_get_client(self):
        h.assert_equal(ckan.get_client(), self.c)

        # singleton now created, so this should have no effect.
        self.MockCkanClient.return_value = None
        h.assert_equal(ckan.get_client(), self.c)