示例#1
0
    def test_json(self):
        p = Post('Test', 'Test content')
        expected = {'title': 'Test', 'content': 'Test content'}

        self.assertDictEqual(expected, p.json())
 def create_post(self, title, content):
     self.posts.append(Post(title, content))
 def test_create_post(self):
     p = Post('Test', 'Test Content')
     # assert uses the TestCase API
     self.assertEqual('Test', p.title)
     self.assertEqual('Test Content', p.content)
    def test_create_post(self):
        p = Post('Test', 'Test content')

        self.assertEqual('Test', p.title)
        self.assertEqual('Test content', p.content)
    def test_json(self):
        p = Post('Test', 'Test Content')
        expected = {'title': 'Test', 'content': 'Test Content'}

        # checks that the keys and values are the same as oppposed to the object being the same
        self.assertDictEqual(expected, p.json())