Пример #1
0
    def testNotesWithinBounds(self):
        testUser = User.objects.create(username='******',
                                       email='*****@*****.**',
                                       pwHash=auth.encryptPass(
                                           'james', 'password'),
                                       lastLogin=dt.now())
        testNote = Note.objects.create(title='test note',
                                       user=testUser,
                                       lat='1.000000',
                                       lng='1.000000',
                                       private=True,
                                       content='this is a note')
        testNote = Note.objects.create(title='test note 2',
                                       user=testUser,
                                       lat='2.000000',
                                       lng='2.000000',
                                       private=True,
                                       content='this is a note')

        notes = Note.objects.filter(user__username__iexact='james2')
        coords = {
            'swLat': Decimal('0.0'),
            'swLng': Decimal('0.0'),
            'neLat': Decimal('1.5'),
            'neLng': Decimal('1.5'),
        }

        self.assertEqual(geography.notesWithinBounds(notes, coords).count(), 1)
Пример #2
0
	def testNotesWithinBounds(self):
		testUser = User.objects.create(username='******', email='*****@*****.**', pwHash=auth.encryptPass('james', 'password'), lastLogin=dt.now())
		testNote = Note.objects.create(title='test note', user=testUser, lat='1.000000', lng='1.000000', private=True, content='this is a note')
		testNote = Note.objects.create(title='test note 2', user=testUser, lat='2.000000', lng='2.000000', private=True, content='this is a note')

		notes = Note.objects.filter(user__username__iexact='james2')
		coords = {
			'swLat': Decimal('0.0'),
			'swLng': Decimal('0.0'),
			'neLat': Decimal('1.5'),
			'neLng': Decimal('1.5'),
		}

		self.assertEqual(geography.notesWithinBounds(notes, coords).count(), 1) 
Пример #3
0
def notesWithinBounds(notes, boundsString):
	return geography.notesWithinBounds(notes, geography.getCoordsFromBounds(boundsString))