Esempio n. 1
0
    def testSeedRelatedModles(self):
        """ FIXME: ERROR
    """
        json = """[{
      "name": "soc.models.linkable.Linkable",
      "number": "1",
      "properties": {
        "link_id": {
          "provider_name": "FixedStringProvider",
          "parameters": {
            "value": "linkable1"
          }
        },
        "links": {
          "provider_name": "RelatedModels",
          "parameters": {
            "name": "soc.models.linkable.Linkable",
            "number": "1",
            "properties": {
              "link_id": {
                "provider_name": "FixedStringProvider",
                "parameters": {
                  "value":"linkable2"
                }
              }
            }
          }
        }
      }
    }]"""
        seeder_logic.seedFromJSON(json)

        # IndexError: The query returned fewer than 1 results
        """
Esempio n. 2
0
  def testSeedRelatedModles(self):
    """ FIXME: ERROR
    """
    json = """[{
      "name": "soc.models.linkable.Linkable",
      "number": "1",
      "properties": {
        "link_id": {
          "provider_name": "FixedStringProvider",
          "parameters": {
            "value": "linkable1"
          }
        },
        "links": {
          "provider_name": "RelatedModels",
          "parameters": {
            "name": "soc.models.linkable.Linkable",
            "number": "1",
            "properties": {
              "link_id": {
                "provider_name": "FixedStringProvider",
                "parameters": {
                  "value":"linkable2"
                }
              }
            }
          }
        }
      }
    }]"""
    seeder_logic.seedFromJSON(json)

    # IndexError: The query returned fewer than 1 results
    """
Esempio n. 3
0
    def testSeedFromJSON(self):
        """Tests getting model data.
    FIXME: FAILURES
    """
        json = """[ {
      "name": "soc.models.linkable.Linkable",
      "number": "5",
      "properties": {
        "link_id": {
          "provider_name": "RandomWordProvider",
          "parameters": {}
        }
      }
    } ]"""
        seeder_logic.seedFromJSON(json)

        # Verify that 5 models were seeded
        """
Esempio n. 4
0
  def testSeedFromJSON(self):
    """Tests getting model data.
    FIXME: FAILURES
    """
    json = """[ {
      "name": "soc.models.linkable.Linkable",
      "number": "5",
      "properties": {
        "link_id": {
          "provider_name": "RandomWordProvider",
          "parameters": {}
        }
      }
    } ]"""
    seeder_logic.seedFromJSON(json)

    # Verify that 5 models were seeded
    """
Esempio n. 5
0
 def seed(self, request, page_name=None, params=None, **kwargs):
   """Starts a seeding operation using the supplied JSON data.
   """
   if request.is_ajax():
     data = request.POST.get('data', None)
     if data:
       try:
         id = seeder_logic.seedFromJSON(data)
       except Error, ex:
         return responses.jsonErrorResponse(request, ex.args[0])
     else:
       return responses.jsonErrorResponse(request, 'No data supplied!')
Esempio n. 6
0
 def seed(self, request, page_name=None, params=None, **kwargs):
     """Starts a seeding operation using the supplied JSON data.
 """
     if request.is_ajax():
         data = request.POST.get('data', None)
         if data:
             try:
                 id = seeder_logic.seedFromJSON(data)
             except Error, ex:
                 return responses.jsonErrorResponse(request, ex.args[0])
         else:
             return responses.jsonErrorResponse(request,
                                                'No data supplied!')