示例#1
0
 def test_missing_position(self):
     request = construct_dummy_request(matchdict={
         'slug': self.issue_cat_or_dog.slug,
         'position_id': None
     })
     response = discussion.valid_position(request)
     self.assertFalse(response, 'position_id is missing')
     self.assertIsInstance(response, bool)
     self.assertIn('issue', request.validated)
     self.assertNotIn('position', request.validated)
示例#2
0
 def test_position_and_issue_are_correct_should_return_true(self):
     request = construct_dummy_request(
         matchdict={
             'slug': self.issue_cat_or_dog.slug,
             'position_id': self.position_cat_or_dog.uid
         })
     response = discussion.valid_position(request)
     self.assertTrue(response)
     self.assertIsInstance(response, bool)
     self.assertIn('issue', request.validated)
     self.assertIn('position', request.validated)
示例#3
0
 def test_position_does_not_belong_to_issue(self):
     request = construct_dummy_request(
         matchdict={
             'slug': self.issue_cat_or_dog.slug,
             'position_id': self.position_town.uid
         })
     response = discussion.valid_position(request)
     self.assertFalse(response)
     self.assertIsInstance(response, bool)
     self.assertIn('issue', request.validated)
     self.assertNotIn('position', request.validated)
示例#4
0
 def test_provided_statement_which_is_no_position(self):
     request = construct_dummy_request(
         matchdict={
             'slug': self.issue_cat_or_dog.slug,
             'position_id': self.statement_cat_or_dog.uid
         })
     response = discussion.valid_position(request)
     self.assertFalse(response)
     self.assertIsInstance(response, bool)
     self.assertIn('issue', request.validated)
     self.assertNotIn('position', request.validated)
示例#5
0
 def test_missing_slug(self):
     request = construct_dummy_request(matchdict={'slug': ''})
     response = discussion.valid_position(request)
     self.assertFalse(response, 'Slug is missing')
     self.assertIsInstance(response, bool)
     self.assertNotIn('issue', request.validated)