def test_conceptapilist(self): concept = Concept() count = concept.count() response = self.client.get(reverse('concept_api_list')) content = json.loads(response.content.decode('utf-8')) self.assertEqual(len(content), count) self.assertEqual(response.status_code, 200)
def test_all_concepts(self): concept = Concept() count = concept.count() response = self.client.get(reverse('all_concepts')) self.assertEqual(response.context['term_type'], 'concept') self.assertEqual(len(response.context['nodes']), count) self.assertEqual(response.status_code, 200)
def test_conceptapidetail_by_name(self): concept = Concept() count = concept.count() response = self.client.get(reverse('concept_api_list'), {'name': self.con1.properties['name']}) content = json.loads(response.content.decode('utf-8')) self.assertEqual(content['id'], self.con1.properties['id']) self.assertEqual(response.status_code, 200)
import numpy Concept = Concept() Task = Task() Disorder = Disorder() Contrast = Contrast() Battery = Battery() Theory = Theory() Condition = Condition() # Needed on all pages counts = { "disorders": Disorder.count(), "tasks": Task.count(), "contrasts": Contrast.count(), "concepts": Concept.count(), "batteries": Battery.count(), "theories": Theory.count() } # VIEWS FOR ALL NODES ############################################################# def all_nodes(request, nodes, node_type): '''all_nodes returns view with all nodes for node_type''' appname = "The Cognitive Atlas" context = { 'appname': appname, 'term_type': node_type[:-1], 'nodes': nodes,
from cognitive.apps.atlas.query import Concept, Task, Disorder, Theory, Battery Concept = Concept() Task = Task() Disorder = Disorder() Theory = Theory() Battery = Battery() # Needed on all pages counts = {"disorders":Disorder.count(), "tasks":Task.count(), "concepts":Concept.count(), "theories":Theory.count(), "batteries":Battery.count()} def counts_processor(request): return {'counts': counts}