Example #1
0
 def test_valid_slug_is_true(self):
     request = construct_dummy_request(
         matchdict={'slug': self.issue_cat_or_dog.slug})
     response = discussion.valid_issue_by_slug(request)
     self.assertTrue(response)
     self.assertIsInstance(response, bool)
     self.assertIn('issue', request.validated)
Example #2
0
    def test_slug_must_be_valid(self):
        request = construct_dummy_request(matchdict={'slug': ''})
        response = discussion.valid_issue_by_slug(request)
        self.assertFalse(response, 'Slug is missing')
        self.assertIsInstance(response, bool)
        self.assertNotIn('issue', request.validated)

        request = construct_dummy_request(matchdict={'slug': 1})
        response = discussion.valid_issue_by_slug(request)
        self.assertFalse(response, 'Slug should be a string')
        self.assertIsInstance(response, bool)
        self.assertNotIn('issue', request.validated)

        request = construct_dummy_request(matchdict={'slug': None})
        response = discussion.valid_issue_by_slug(request)
        self.assertFalse(response, 'Slug should be a string')
        self.assertIsInstance(response, bool)
        self.assertNotIn('issue', request.validated)
Example #3
0
 def test_disabled_slug_is_false(self):
     request = construct_dummy_request(
         matchdict={'slug': self.issue_disabled.slug})
     response = discussion.valid_issue_by_slug(request)
     self.assertFalse(
         response,
         'The field-experiment-issue is disabled in the development-seed and can\'t be queried'
     )
     self.assertIsInstance(response, bool)
     self.assertNotIn('issue', request.validated)