Beispiel #1
0
    def testDeleteNotExisted(self):
        """Test that deleting a not existed entry does not affects the data store.
    """

        entity = TestModel(key_name='test/%d' % 5, value=5)
        self.logic.delete(entity)
        query = TestModel.all()
        expected = len(self.entities)
        actual = len(query.fetch(expected))
        self.assertEqual(expected, actual)
Beispiel #2
0
  def setUp(self):
    """Set up required for the slot allocation tests.
    """

    entities = []

    for i in range(5):
      entity = TestModel(key_name='test/%d' % i, value=i)
      entity.put()
      entities.append(entity)

    self.logic = TestModelLogic()
    self.entities = entities
Beispiel #3
0
    def setUp(self):
        """Set up required for the slot allocation tests.
    """

        entities = []

        for i in range(5):
            entity = TestModel(key_name='test/%d' % i, value=i)
            entity.put()
            entities.append(entity)

        self.logic = TestModelLogic()
        self.entities = entities
Beispiel #4
0
  def testGetAllNonMatchingNoEntities(self):
    """Test that non matching returns an empty list.
    """

    query = TestModel.all()
    query.filter('value >', 5)
    expected = []
    actual = self.logic.getAll(query = query)
    self.assertEqual(expected, actual)
Beispiel #5
0
    def testGetAllNonMatchingNoEntities(self):
        """Test that non matching returns an empty list.
    """

        query = TestModel.all()
        query.filter('value >', 5)
        expected = []
        actual = self.logic.getAll(query=query)
        self.assertEqual(expected, actual)
Beispiel #6
0
  def testGetAllNoEntities(self):
    """Test that it returns an empty list when there is no entity in datastore.
    """

    for entity in self.entities:
      entity .delete()
    query = TestModel.all()
    expected = []
    actual = self.logic.getAll(query = query)
    self.assertEqual(expected, actual)
Beispiel #7
0
  def testDeleteNotExisted(self):
    """Test that deleting a not existed entry does not affects the data store.
    """

    entity = TestModel(key_name='test/%d' % 5, value=5)
    self.logic.delete(entity)
    query = TestModel.all()
    expected = len(self.entities)
    actual = len(query.fetch(expected))
    self.assertEqual(expected, actual)
Beispiel #8
0
    def testGetAllNoEntities(self):
        """Test that it returns an empty list when there is no entity in datastore.
    """

        for entity in self.entities:
            entity.delete()
        query = TestModel.all()
        expected = []
        actual = self.logic.getAll(query=query)
        self.assertEqual(expected, actual)
Beispiel #9
0
  def testGetAll(self):
    """Test that all entries are retrieved.

    Note: an error will be raised if there are more than 1k entries
    in the current implementation.
    """

    query = TestModel.all()
    expected = set(range(5))
    actual = set([i.value for i in self.logic.getAll(query = query)])
    self.assertEqual(expected, actual)
Beispiel #10
0
  def testDelete(self):
    """Test that entry can be deleted.
    """

    entity = self.entities[0]
    self.logic.delete(entity)
    query = TestModel.all()
    query.filter('value =', 0)
    expected = None
    actual = query.get()
    self.assertEqual(expected, actual)
Beispiel #11
0
    def testGetAll(self):
        """Test that all entries are retrieved.

    Note: an error will be raised if there are more than 1k entries
    in the current implementation.
    """

        query = TestModel.all()
        expected = set(range(5))
        actual = set([i.value for i in self.logic.getAll(query=query)])
        self.assertEqual(expected, actual)
Beispiel #12
0
    def testDelete(self):
        """Test that entry can be deleted.
    """

        entity = self.entities[0]
        self.logic.delete(entity)
        query = TestModel.all()
        query.filter('value =', 0)
        expected = None
        actual = query.get()
        self.assertEqual(expected, actual)