Merge pull request #5 from pyohio/update-requirements

Update requirements
This commit is contained in:
David Ray 2014-01-16 05:14:04 -08:00
commit 5d4b81ae86
7 changed files with 34 additions and 185 deletions

View file

@ -4,11 +4,17 @@ A conference management solution from Eldarion.
Built with the generous support of the Python Software Foundation. Built with the generous support of the Python Software Foundation.
See http://eldarion.com/symposion/ for commercial support, customization and hosting See http://eldarion.com/symposion/ for commercial support, customization and
hosting.
## Quickstart ## Quickstart
If you're interested in running symposion locally, we have built a [basic To install Symposion, run:
pip install symposion
Symposion is a Django app. You will need to create a Django project to
customize and manage your Symposion installation. We have built a [basic
Django startproject template that includes Symposion][1]. Django startproject template that includes Symposion][1].
[1]: https://github.com/pinax/pinax-project-symposion [1]: https://github.com/pinax/pinax-project-symposion

13
requirements/base.txt Normal file
View file

@ -0,0 +1,13 @@
Django==1.4.5
django-appconf==0.5
django-forms-bootstrap==2.0.3.post2
django-markitup==1.0.0
django-model-utils==1.1.0
django-reversion==1.7
django-sitetree==0.9.4
django-taggit==0.9.3
django-timezones==0.2
django-user-accounts==1.0b13
easy-thumbnails==1.2
html5lib==0.95
markdown==2.3.1

View file

@ -1,10 +1,20 @@
#!/usr/bin/env python #!/usr/bin/env python
import os
from setuptools import setup, find_packages from setuptools import setup, find_packages
import symposion import symposion
def read_file(filename):
"""Read a file into a string."""
path = os.path.abspath(os.path.dirname(__file__))
filepath = os.path.ojoin(path, filename)
try:
return open(filepath).read()
except IOError:
return ''
setup( setup(
name="symposion", name="symposion",
author="James Tauber", author="James Tauber",
@ -12,7 +22,7 @@ setup(
version=symposion.__version__, version=symposion.__version__,
description="A collection of Django apps for conference websites.", description="A collection of Django apps for conference websites.",
url="http://eldarion.com/symposion/", url="http://eldarion.com/symposion/",
packages=find_packages(exclude=["symposion_project"]), packages=find_packages(),
include_package_data=True, include_package_data=True,
classifiers=( classifiers=(
"Development Status :: 4 - Beta", "Development Status :: 4 - Beta",
@ -22,4 +32,5 @@ setup(
"Natural Language :: English", "Natural Language :: English",
"License :: OSI Approved :: MIT License", "License :: OSI Approved :: MIT License",
), ),
install_requires=read_file("requirements/base.txt").splitlines(),
) )

View file

@ -1,9 +0,0 @@
from django.contrib.auth.models import Group
from fixture_generator import fixture_generator
@fixture_generator(Group)
def initial_data():
Group.objects.create(name="reviewers")
Group.objects.create(name="reviewers-admins")

View file

@ -1,143 +0,0 @@
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.contrib.auth.models import User, Group
from symposion.proposals.models import Proposal
from symposion.reviews.models import Review, ReviewAssignment
class login(object):
def __init__(self, testcase, user, password):
self.testcase = testcase
success = testcase.client.login(username=user, password=password)
self.testcase.assertTrue(
success,
"login with username=%r, password=%r failed" % (user, password)
)
def __enter__(self):
pass
def __exit__(self, *args):
self.testcase.client.logout()
class ReviewTests(TestCase):
fixtures = ["proposals"]
def get(self, url_name, *args, **kwargs):
return self.client.get(reverse(url_name, args=args, kwargs=kwargs))
def post(self, url_name, *args, **kwargs):
data = kwargs.pop("data")
return self.client.post(reverse(url_name, args=args, kwargs=kwargs), data)
def login(self, user, password):
return login(self, user, password)
def test_detail_perms(self):
guidos_proposal = Proposal.objects.all()[0]
response = self.get("review_detail", pk=guidos_proposal.pk)
# Not logged in
self.assertEqual(response.status_code, 302)
with self.login("guido", "pythonisawesome"):
response = self.get("review_detail", pk=guidos_proposal.pk)
# Guido can see his own proposal.
self.assertEqual(response.status_code, 200)
with self.login("matz", "pythonsucks"):
response = self.get("review_detail", pk=guidos_proposal.pk)
# Matz can't see guido's proposal
self.assertEqual(response.status_code, 302)
larry = User.objects.get(username="larryw")
# Larry is a trustworthy guy, he's a reviewer.
larry.groups.add(Group.objects.get(name="reviewers"))
with self.login("larryw", "linenoisehere"):
response = self.get("review_detail", pk=guidos_proposal.pk)
# Reviewers can see a review detail page.
self.assertEqual(response.status_code, 200)
def test_reviewing(self):
guidos_proposal = Proposal.objects.all()[0]
with self.login("guido", "pythonisawesome"):
response = self.post("review_review", pk=guidos_proposal.pk, data={
"vote": "+1",
})
# It redirects, but...
self.assertEqual(response.status_code, 302)
# ... no vote recorded
self.assertEqual(guidos_proposal.reviews.count(), 0)
larry = User.objects.get(username="larryw")
# Larry is a trustworthy guy, he's a reviewer.
larry.groups.add(Group.objects.get(name="reviewers"))
with self.login("larryw", "linenoisehere"):
response = self.post("review_review", pk=guidos_proposal.pk, data={
"vote": "+0",
"text": "Looks like a decent proposal, and Guido is a smart guy",
})
self.assertEqual(response.status_code, 302)
self.assertEqual(guidos_proposal.reviews.count(), 1)
self.assertEqual(ReviewAssignment.objects.count(), 1)
assignment = ReviewAssignment.objects.get()
self.assertEqual(assignment.proposal, guidos_proposal)
self.assertEqual(assignment.origin, ReviewAssignment.OPT_IN)
self.assertEqual(guidos_proposal.comments.count(), 1)
comment = guidos_proposal.comments.get()
self.assertFalse(comment.public)
response = self.post("review_review", pk=guidos_proposal.pk, data={
"vote": "+1",
"text": "Actually Perl is dead, we really need a talk on the future",
})
self.assertEqual(guidos_proposal.reviews.count(), 2)
self.assertEqual(ReviewAssignment.objects.count(), 1)
assignment = ReviewAssignment.objects.get()
self.assertEqual(assignment.review, Review.objects.order_by("-id")[0])
self.assertEqual(guidos_proposal.comments.count(), 2)
# Larry's a big fan...
response = self.post("review_review", pk=guidos_proposal.pk, data={
"vote": "+20",
})
self.assertEqual(guidos_proposal.reviews.count(), 2)
def test_speaker_commenting(self):
guidos_proposal = Proposal.objects.all()[0]
with self.login("guido", "pythonisawesome"):
response = self.get("review_comment", pk=guidos_proposal.pk)
# Guido can comment on his proposal.
self.assertEqual(response.status_code, 200)
response = self.post("review_comment", pk=guidos_proposal.pk, data={
"text": "FYI I can do this as a 30-minute or 45-minute talk.",
})
self.assertEqual(response.status_code, 302)
self.assertEqual(guidos_proposal.comments.count(), 1)
comment = guidos_proposal.comments.get()
self.assertTrue(comment.public)
larry = User.objects.get(username="larryw")
# Larry is a trustworthy guy, he's a reviewer.
larry.groups.add(Group.objects.get(name="reviewers"))
with self.login("larryw", "linenoisehere"):
response = self.get("review_comment", pk=guidos_proposal.pk)
# Larry can comment, since he's a reviewer
self.assertEqual(response.status_code, 200)
response = self.post("review_comment", pk=guidos_proposal.pk, data={
"text": "Thanks for the heads-up Guido."
})
self.assertEqual(response.status_code, 302)
self.assertEqual(guidos_proposal.comments.count(), 2)
with self.login("matz", "pythonsucks"):
response = self.get("review_comment", pk=guidos_proposal.pk)
# Matz can't comment.
self.assertEqual(response.status_code, 302)

View file

@ -1,29 +0,0 @@
from django.contrib.auth.models import User
from fixture_generator import fixture_generator
from symposion.speakers.models import Speaker
@fixture_generator(Speaker, User)
def speakers():
guido = User.objects.create_user("guido", "guido@python.org", "pythonisawesome")
matz = User.objects.create_user("matz", "matz@ruby.org", "pythonsucks")
larry = User.objects.create_user("larryw", "larry@perl.org", "linenoisehere")
Speaker.objects.create(
user=guido,
name="Guido van Rossum",
biography="I wrote Python, and named it after Monty Python",
)
Speaker.objects.create(
user=matz,
name="Yukihiro Matsumoto",
biography="I wrote Ruby, and named it after the rare gem Ruby, a pun "
"on Perl/pearl.",
)
Speaker.objects.create(
user=larry,
name="Larry Wall",
biography="I wrote Perl, and named it after the Parable of the Pearl",
)