Example #1
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)
Example #2
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)
Example #3
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)
Example #4
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)
Example #5
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)
Example #6
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)
Example #7
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)
Example #8
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)
Example #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)
Example #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)