def test_instance_is_created_successfully(self): category = fixtures.get_category() data = { 'name': 'Gigabit Hub', 'category': category, } instance = Location.objects.create(**data) ok_(instance.id) eq_(instance.name, 'Gigabit Hub') eq_(instance.website, '') ok_(instance.position) eq_(instance.category, category) ok_(instance.created) ok_(instance.modified)
def test_unpublished_locations_are_not_shown(self): category = fixtures.get_category() fixtures.get_location(category=category, status=Location.DRAFT) eq_(list(Location.published.all()), [])
def test_published_locations_are_shown(self): category = fixtures.get_category() location = fixtures.get_location( category=category, status=Location.PUBLISHED) eq_(list(Location.published.all()), [location])
def test_get_image_url_is_empty(self): category = fixtures.get_category() instance = fixtures.get_location(category=category) eq_(instance.get_image_url(), '')
def test_get_image_url_is_from_category(self): category = fixtures.get_category(image='boo.png') instance = fixtures.get_location(category=category) eq_(instance.get_image_url(), '/media/boo.png')