Last active
February 27, 2016 18:56
-
-
Save mekhami/89553d8a3d7c022efe57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProjectViewsTest(TestCase): | |
def setUp(self): | |
self.project = Project.objects.create(name='google') | |
self.request = RequestFactory().get('/fake-path/') | |
def test_project_display_context_data(self): | |
view = ProjectDisplay() | |
view = setup_view(view, self.request, slug=self.project.slug) | |
self.assertIn('form', view.get_context_data()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Creating test database for alias 'default'... | |
.E............ | |
====================================================================== | |
ERROR: test_project_display_context_data (buffet.tests.ProjectViewsTest) | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/home/ldvp/work/buffet/buffet/tests.py", line 118, in test_project_display_context_data | |
self.assertIn('form', view.get_context_data()) | |
File "/home/ldvp/work/buffet/buffet/views.py", line 29, in get_context_data | |
context = super(ProjectDisplay, self).get_context_data(**kwargs) | |
File "/home/ldvp/virt/buffet/local/lib/python2.7/site-packages/django/views/generic/detail.py", line 101, in get_context_data | |
if self.object: | |
AttributeError: 'ProjectDisplay' object has no attribute 'object' | |
---------------------------------------------------------------------- | |
Ran 14 tests in 0.544s | |
FAILED (errors=1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProjectDisplay(LoginRequiredMixin, DetailView): | |
model = Project | |
context_object_name = 'project' | |
def get_context_data(self, **kwargs): | |
context = super(ProjectDisplay, self).get_context_data(**kwargs) | |
context['form'] = ServiceTypeForm() | |
return context |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment