MCPcopy Index your code
hub / github.com/realpython/discover-flask / BlogPostTests

Class BlogPostTests

tests/test_blog.py:8–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6
7
8class BlogPostTests(BaseTestCase):
9
10 # Ensure a logged in user can add a new post
11 def test_user_can_post(self):
12 with self.client:
13 self.client.post(
14 '/login',
15 data=dict(username="admin", password="admin"),
16 follow_redirects=True
17 )
18 response = self.client.post(
19 '/',
20 data=dict(title="test", description="test"),
21 follow_redirects=True
22 )
23 self.assertEqual(response.status_code, 200)
24 self.assertIn(b'New entry was successfully posted. Thanks.',
25 response.data)
26
27
28if __name__ == '__main__':

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected