@override_settings(SERRANO_AUTH_REQUIRED=True)
    def test_post(self):
        User.objects.create_user(username='root', password='password')
        response = self.client.post(
            '/api/',
            content_type='application/json',
            HTTP_ACCEPT='application/json')
        self.assertEqual(response.status_code, codes.unauthorized)

        response = self.client.post(
            '/api/',
            json.dumps({'username': 'root', 'password': 'password'}),
            content_type='application/json',
            HTTP_ACCEPT='application/json')

        self.assertEqual(response.status_code, codes.ok)
        self.assertTrue(json.loads(response.content) in 'token')

        # Confirm that passing an invalid username/password returns a status
        # code of codes.unauthorized -- unauthorized.
        response = self.client.post(
            '/api/',
            json.dumps({'username': 'root', 'password': 'NOT_THE_PASSWORD'}),
            content_type='application/json')

        self.assertEqual(response.status_code, codes.unauthorized)
dataset/ETHPy150Open chop-dbhi/serrano/tests/cases/resources/tests/base.py/RootResourceTestCase.test_post/swapped operands of `in`