def put(self): import index super(Topic, self).put() # we are not using url_for here # since we don't want /admin in urls url = '/%s' % self.get_key_name() index.add(body=self.body, category=self.category, description=self.meta_description, name=self.name, url=url) return self
def test_add(self): value1 = 2 value2 = 4 expect = 6 actual = index.add(value1, value2) self.assertEqual(expect, actual)
def testAdd(self): helptext = { 'category':"the category", 'name':"the title", 'body':"the body", 'url': "/cat/name/" } index.add(**helptext) results = index.find(query='body') self.assertEquals(results.total, 1) result = results[0] self.assertEquals(result['name'], 'the title') self.assertEquals(result['category'], 'the category') # adding with same id should ovewrite index.add(**helptext) result = index.find(query='body') self.assertEquals(result.total, 1)
def testAdd(self): helptext = { 'category': "the category", 'name': "the title", 'body': "the body", 'url': "/cat/name/" } index.add(**helptext) results = index.find(query='body') self.assertEquals(results.total, 1) result = results[0] self.assertEquals(result['name'], 'the title') self.assertEquals(result['category'], 'the category') # adding with same id should ovewrite index.add(**helptext) result = index.find(query='body') self.assertEquals(result.total, 1)
def test_method1(): assert func(10, 20) == add(10, 20)
def command_add(args): print('@', sys._getframe().f_code.co_name) index.add(args.patterns)