示例#1
0
    def test_single_aggregation_trees(self):
        aggregation_tree = {"org_chart": ["CEO", "Architect", "Developer"]}
        entity = Entity(geocode="1234", geoname="Accra", unique_name="Kajelo CHPS", aggregation_tree=aggregation_tree)
        entity.save()

        loaded_entity = query.get(uuid=entity.uuid)
        self.assertEqual(loaded_entity.aggregation_tree["org_chart"], ["CEO", "Architect", "Developer"])
示例#2
0
    def test_if_reported_at_attribute_is_created(self):
        entity = Entity(geocode="1234", geoname="Accra", unique_name="Kajelo CHPS")
        entity.save()

        data_record = entity.submit_datarecord(
            record_dict={"name": "arv", "value": "40", "type": "int"}, reported_at=datetime.datetime.now()
        )
        data_record.save()
        self.assertEqual(data_record.reported_at.date(), datetime.datetime.now().date())
示例#3
0
    def test_add_data_record_to_entity(self):
        entity = Entity(geocode="1234", geoname="Accra", unique_name="Kajelo CHPS")
        entity.save()

        data_record = entity.submit_datarecord(
            record_dict={"name": "arv", "value": "40", "type": "int"}, reported_at=datetime.datetime.now()
        )
        data_record.save()
        self.assertEqual(data_record.for_entity_uuid, entity.uuid)
示例#4
0
    def test_entity_state(self):
        entity = Entity(geocode="9876", geoname="Gulu", unique_name="Ashianti")
        entity.save()

        data_record = entity.submit_datarecord(
            record_dict={"name": "arv", "value": "12", "type": "int"}, reported_at=datetime.date(2011, 03, 01)
        )
        data_record.save()
        data_record = entity.submit_datarecord(
            record_dict={"name": "arv", "value": "1", "type": "int"}, reported_at=datetime.date(2011, 03, 13)
        )
示例#5
0
    def test_discover_data_types_of_the_datarecords(self):
        entity = Entity(geocode="1234", geoname="Gulu", unique_name="Ashianti CHPS")
        entity.save()

        data_record = entity.submit_datarecord(
            record_dict={"name": "arv", "value": "12", "type": "int"}, reported_at=datetime.date(2011, 03, 01)
        )
        data_record.save()
        data_record = entity.submit_datarecord(
            record_dict={"name": "patients", "value": "1", "type": "int"}, reported_at=datetime.date(2011, 03, 03)
        )
        data_record.save()

        data_types = entity.get_data_records_types()
        self.assertEqual(data_types, {"patients": "int", "arv": "int"})
示例#6
0
 def test_create_entity(self):
     entity = Entity(geocode="1234", geoname="Ghana", unique_name="Navio CHPS")
     entity.save()
     self.assertEqual(entity.geoname, "Ghana")
示例#7
0
 def test_enity_has_created_at(self):
     entity = Entity(geocode="1234", geoname="Accra", unique_name="Kajelo CHPS")
     entity.save()
示例#8
0
    def test_load_entity(self):
        entity = Entity(geocode="123466", geoname="Ghana", unique_name="Navio CHPS")
        entity.save()

        loaded_entity = query.get(uuid=entity.uuid)
        self.assertEqual(loaded_entity.uuid, entity.uuid)