예제 #1
0
 def test_jsondict2mp(self):
     geojson_file = open(
         'lizard_area/testsources/peilgebieden_from_wfs.json')
     content = json.loads(geojson_file.read())
     geojson_file.close()
     synchronizer = Synchronizer()
     self.assertTrue(synchronizer.check_content(content))
예제 #2
0
 def test_replace_suffix(self):
     date_string = "11-11-2012"
     synchronizer = Synchronizer()
     self.assertTrue(date_string == synchronizer.replace_suffix(
             "{0}Z".format(date_string)))
     self.assertFalse(date_string == synchronizer.replace_suffix(None))
     self.assertTrue(date_string == synchronizer.replace_suffix(date_string))
예제 #3
0
def run_sync_area(options, logger=None):
    """
    Synchronise 'aanafvoergieden with WFS.
    """
    synchronizer = Synchronizer(logger)

    if logger is None:
        logger = default_logger

    datasets = DataSet.objects.filter(name=options['dataset'])
    if datasets.exists() == False:

        datasets = DataSet.objects.all()
        names_str = ""
        for dataset in datasets:
            names_str = "%s\n%s" % (names_str, dataset.name)
        logger.error(
            'Option "--dataset" is reguired, choices:\n%s\n',
            names_str)
        return

    areatype_ok = False
    for item in AREA_TYPES:
        if options['areatype'] in item:
            areatype_ok = True
    if areatype_ok == False:
        logger.error(
            'Option "--areatype" is reguired, choices:\n%s\n',
            "\n".join(['%s' % v[1] for v in AREA_TYPES]))
        return

    synchronizer.run_sync(options['username'],
                          options['areatype'],
                          datasets[0])

    logger.info('create empty links')
    counter = 0

    for area in Area.objects.filter(area_class = Area.AREA_CLASS_KRW_WATERLICHAAM, arealink_a__isnull=True):
        area_link = AreaLink(area_a=area)
        area_link.save()
        counter += 1

    logger.info('Finished creating empty area links for KRW areas (%i links created).'%counter)
예제 #4
0
def test_b():
    synchronizer = Synchronizer()
    orig_dict = {'gafsoort_krw': 'dont care'}
    assert orig_dict == synchronizer.properties_keys_to_lower(orig_dict)
    orig_dict = {'fsoort_krw': 'dont care'}
    assert {'gafsoort_krw': 'dont care'} == synchronizer.properties_keys_to_lower(orig_dict)
예제 #5
0
def test_a():
    synchronizer = Synchronizer()
    assert len(synchronizer.properties_keys_to_lower({})) == 0