def setUp(self):
     berlin = models.Venue(name="Berlin test Venue",
                           street_address="Somewhere Str. 0",
                           country="DE")
     berlin.latitude = 52.50693980
     berlin.longitude = 13.42415920
     berlin.save()
     self.user = Mock()
     self.user.email = '*****@*****.**'
     self.e1 = self.add_event("E1", berlin, 3)
     self.e2 = self.add_event("E2", berlin, 2)
     self.e3 = self.add_bsd_event("E3", berlin, 1, 'jjj')
    def setup_events(self):
        london = models.Venue(name="Test Venue",
                              street_address="0 Somewhere St",
                              country="GB")
        london.latitude = 51.510345
        london.longitude = -0.127072
        london.save()
        berlin = models.Venue(name="Berlin test Venue",
                              street_address="Somewhere Str. 0",
                              country="DE")
        berlin.latitude = 52.50693980
        berlin.longitude = 13.42415920
        berlin.save()

        e1 = self.add_event("E1", london, 3)
        e2 = self.add_event("E2", berlin, 2)
        e3 = self.add_event("E3", london, 1)

        eu = self.add_event("EU", berlin, 9, verified=False)
        ep = self.add_event("EP", berlin, 10, public=False)
        ed = self.add_event("ED", london, 8, pending_deletion=True)

        return (e1, e2, e3, ep)
    def test_lat_lng_can_be_set_on_instantiation(self):
        venue = models.Venue(latitude="51.0", longitude="4")

        eq_(venue.location, geos.Point(4.0, 51.0))
    def test_longitude_can_be_set(self):
        venue = models.Venue()
        venue.longitude = 51.456

        eq_(venue.location, geos.Point(51.456, 0))
    def test_longitude_can_be_gotten(self):
        venue = models.Venue(location=geos.Point(42, 24))

        eq_(venue.longitude, 42.0)
    def test_that_model_instances_of_different_classes_compare_false(self):
        e1 = models.Event(id=1, name="Hallo")
        e2 = models.Venue(id=1, name="Hallo")

        ok_(not models.EventAndVenueUpdater.are_model_instances_identical(
            e1, e2))
    def test_latitude_can_be_set(self):
        venue = models.Venue()
        venue.latitude = 51.456

        eq_(venue.location, geos.Point(0, 51.456))
 def test_location_is_always_initialized_as_a_point_object(self):
     venue = models.Venue()
     self.assertIsNotNone(venue.location.wkt)