Exemplo n.º 1
0
 def test_fetch_chunks(self):
     user, created = User.objects.get_or_create(username="******")
     blank_conf = EditRegionConfiguration(obj=user)
     template = Template(
         """{
         "x": {},
         "y": {},
         "z": {}
     }"""
     )
     blank_conf.raw_config = blank_conf.decode_template_region_configuration(template_instance=template)
     blank_conf.config = blank_conf.get_template_region_configuration(raw_data=blank_conf.raw_config)
     results = blank_conf.fetch_chunks()
     self.assertEqual(dict(results), {u"y": [], u"x": [], u"z": []})
Exemplo n.º 2
0
 def test_json_serializer(self):
     user, created = User.objects.get_or_create(username="******")
     blank_conf = EditRegionConfiguration(obj=user)
     template = Template(
         """{
         "test": {
             "name": "whee!",
             "models": {
                 "embeds.Iframe": 2
             }
         },
         "test2": {
             "name": "oh my goodness, another test region",
             "models": {
                 "embeds.Iframe": 1
             }
         },
         "test3": {
             "name": "oh my goodness, yet another test region",
             "models": {
                 "embeds.Iframe": null
             }
         }
     }"""
     )
     blank_conf.raw_config = blank_conf.decode_template_region_configuration(template_instance=template)
     blank_conf.config = blank_conf.get_template_region_configuration(raw_data=blank_conf.raw_config)
     self.assertEqual(
         dict(blank_conf.config),
         {
             "test": {"models": {Iframe: 2}, "name": "whee!"},
             "test2": {"models": {Iframe: 1}, "name": "oh my goodness, another test region"},
             "test3": {"models": {Iframe: None}, "name": "oh my goodness, yet another test region"},
         },
     )
     results = blank_conf.fetch_chunks()
     self.assertEqual(dict(results), {"test": [], "test3": [], "test2": []})