Exemplo n.º 1
0
    def test_flytoview_formatting(self):
        """ Tests that the flytoview is appropriate for Google Earth. """
        bookmark = Bookmark()

        bookmark.title = 'End Point HQ'
        bookmark.description = 'New York City Headquarters of End Point Corporation'
        bookmark.flytoview = """
<LookAt>\r
<longitude>-73.98959999994308</longitude>\r
<latitude>40.73970000013086</latitude>\r
<altitude>0</altitude>\r
<heading>3.714030842021182e-11</heading>\r
<tilt>0</tilt>\r
<range>1500.000015133294</range>\r
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>\r
</LookAt>\r
"""

        required_output = """flytoview=<LookAt><longitude>-73.98959999994308</longitude><latitude>40.73970000013086</latitude><altitude>0</altitude><heading>3.714030842021182e-11</heading><tilt>0</tilt><range>1500.000015133294</range><gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode></LookAt>"""

        self.assertEqual(bookmark.as_query_txt(), required_output)
Exemplo n.º 2
0
    def DONT_test_fields_and_saving(self):
        """ Tests that an object can be created, populated, and saved. """
        bookmark = Bookmark()

        bookmark = Bookmark()

        bookmark.title = 'End Point HQ'
        bookmark.description = 'New York City Headquarters of End Point Corporation'

        bookmark.flytoview = """
<LookAt>\r
<longitude>-73.98959999994308</longitude>\r
<latitude>40.73970000013086</latitude>\r
<altitude>0</altitude>\r
<heading>3.714030842021182e-11</heading>\r
<tilt>0</tilt>\r
<range>1500.000015133294</range>\r
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>\r
</LookAt>\r
"""
        bookmark.save()
Exemplo n.º 3
0
    def handle(self, *args, **options):

        check_groups()

        f = open(QUERIES_FILE_PATH, 'rb')

        reader = csv.DictReader(
            f,
            fieldnames=FIELDNAMES,
            delimiter='@',
            quoting=csv.QUOTE_NONE,
        )

        for row in reader:
            self.stdout.write(str(row))
            if not is_valid_planet(row['planet']):
                continue
            b = Bookmark()
            b.title = row['title']
            b.slug = slugify(row['title'])
            b.flytoview = strip_flytoview(row['flytoview'])
            b.group = BookmarkGroup.objects.get(slug=row['planet'])
            b.save()
Exemplo n.º 4
0
    def DONT_test_fields_and_saving(self):
        """ Tests that an object can be created, populated, and saved. """
        bookmark = Bookmark()

        bookmark = Bookmark()

        bookmark.title = 'End Point HQ'
        bookmark.description = 'New York City Headquarters of End Point Corporation'

        bookmark.flytoview = """
<LookAt>\r
<longitude>-73.98959999994308</longitude>\r
<latitude>40.73970000013086</latitude>\r
<altitude>0</altitude>\r
<heading>3.714030842021182e-11</heading>\r
<tilt>0</tilt>\r
<range>1500.000015133294</range>\r
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>\r
</LookAt>\r
"""
        bookmark.save()
  def handle(self, *args, **options):

    check_groups()

    f = open(QUERIES_FILE_PATH, 'rb')

    reader = csv.DictReader(
	f,
	fieldnames=FIELDNAMES,
	delimiter='@',
	quoting=csv.QUOTE_NONE,
    )

    for row in reader:
	self.stdout.write(str(row))
        if not is_valid_planet(row['planet']):
            continue
        b = Bookmark()
        b.title = row['title']
        b.slug = slugify(row['title'])
        b.flytoview = strip_flytoview(row['flytoview'])
        b.group = BookmarkGroup.objects.get(slug=row['planet'])
        b.save()
Exemplo n.º 6
0
    def test_flytoview_formatting(self):
        """ Tests that the flytoview is appropriate for Google Earth. """
        bookmark = Bookmark()

        bookmark.title = 'End Point HQ'
        bookmark.description = 'New York City Headquarters of End Point Corporation'
        bookmark.flytoview = """
<LookAt>\r
<longitude>-73.98959999994308</longitude>\r
<latitude>40.73970000013086</latitude>\r
<altitude>0</altitude>\r
<heading>3.714030842021182e-11</heading>\r
<tilt>0</tilt>\r
<range>1500.000015133294</range>\r
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>\r
</LookAt>\r
"""

        required_output = """flytoview=<LookAt><longitude>-73.98959999994308</longitude><latitude>40.73970000013086</latitude><altitude>0</altitude><heading>3.714030842021182e-11</heading><tilt>0</tilt><range>1500.000015133294</range><gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode></LookAt>"""

        self.assertEqual(bookmark.as_query_txt(), required_output)