def test_id_exist(self): self.predictResult = [{ 'id': 1, 'name': 'chain1', }, { 'id': 2, 'name': 'chain2', }] self.realResult = getChainList(self.project.pk) self.assertEqual(cmp(self.realResult, self.predictResult), 0)
def test_id_exist(self): self.predictResult = [{ 'id':1, 'name':'chain1', },{ 'id':2, 'name':'chain2', }] self.realResult = getChainList(self.project.pk) self.assertEqual(cmp(self.realResult,self.predictResult),1)
def getProjectChains(request): projectId = request.GET.get('id','') result = getChainList(int(projectId)) return HttpResponse(json.dumps(result), content_type="application/json")
def test_id_null(self): self.predictResult = [] self.realResult = getChainList(None) self.assertEqual(cmp(self.realResult, self.predictResult), 0)
def test_id_not_exist(self): self.predictResult = [] self.realResult = getChainList(5) self.assertEqual(cmp(self.realResult, self.predictResult), 0)
def test_id_null(self): self.predictResult = [] self.realResult = getChainList(None) self.assertEqual(cmp(self.realResult,self.predictResult),0)
def test_id_not_exist(self): self.predictResult = [] self.realResult = getChainList(5) self.assertEqual(cmp(self.realResult,self.predictResult),0)