Ejemplo n.º 1
0
 def test_dump_widget_data(self):
     widget_data_sets = [
         (
             "national_leadership",
             'test_exports/d_national_leadership.json',
         ),
         (
             'race_rings',
             'test_exports/d_race_rings.json',
         ),
         (
             'rivers',
             'test_exports/d_rivers.json',
         ),
     ]
     for url, fn in widget_data_sets:
         fp = open(fn)
         file_dump = json.load(fp)
         raw_dump = export_widget_data(url)
         json_dump = jsonize(raw_dump)
         cooked_json = json.loads(json_dump)
         self.assertTrue(
             json_equal(file_dump,
                        cooked_json,
                        url,
                        ignore_keys=[
                            "widget_last_updated",
                        ]))
Ejemplo n.º 2
0
class Command(BaseCommand):
    help = "Export data for named Widget Family to stdout"
    def add_arguments(self, parser):
        parser.add_argument("url", type=unicode)
    def handle(self, *args, **options):
        try:
            data = export_widget_data(options["url"])
        except ImportExportException, e:
            raise CommandError(unicode(e))
        print >> self.stdout, jsonize(data, True)
Ejemplo n.º 3
0
 def test_dump_widget_data(self):
     widget_data_sets = [
         ("national_leadership", 'test_exports/d_national_leadership.json',),
         ('race_rings', 'test_exports/d_race_rings.json',),
         ('rivers', 'test_exports/d_rivers.json',),
     ]
     for url, fn in widget_data_sets:
         fp = open(fn)
         file_dump = json.load(fp)
         raw_dump = export_widget_data(url)
         json_dump = jsonize(raw_dump)
         cooked_json = json.loads(json_dump)
         self.assertTrue(json_equal(file_dump, cooked_json, url, ignore_keys=[ "widget_last_updated", ]))
Ejemplo n.º 4
0
 def test_dump_widgets(self):
     widgets = [
         ('national_leadership', 'test_exports/w_national_leadership.json', ),
         ('race_rings', 'test_exports/w_race_rings.json',),
         ('rivers', 'test_exports/w_rivers.json',),
     ]
     for url, fn in widgets:
         fp = open(fn)
         file_dump = json.load(fp)
         wf = WidgetFamily.objects.get(url=url)
         raw_dump = wf.export()
         json_dump = jsonize(raw_dump)
         cooked_json = json.loads(json_dump)
         self.assertTrue(json_equal(file_dump, cooked_json, url))
Ejemplo n.º 5
0
 def test_dump_widgets(self):
     widgets = [
         (
             'national_leadership',
             'test_exports/w_national_leadership.json',
         ),
         (
             'race_rings',
             'test_exports/w_race_rings.json',
         ),
         (
             'rivers',
             'test_exports/w_rivers.json',
         ),
     ]
     for url, fn in widgets:
         fp = open(fn)
         file_dump = json.load(fp)
         wf = WidgetFamily.objects.get(url=url)
         raw_dump = wf.export()
         json_dump = jsonize(raw_dump)
         cooked_json = json.loads(json_dump)
         self.assertTrue(json_equal(file_dump, cooked_json, url))