@gen_test
    def test_change_password(self):
        client = AsyncfluxClient()
        db_name = 'foo'
        db = client[db_name]
        username = 'foo'
        password = 'fubar'
        user = User(db, username)

        with self.patch_fetch_mock(client) as m:
            self.setup_fetch_mock(m, 200)
            response = yield user.change_password(password)
            self.assertIsNone(response)

            self.assert_mock_args(m, '/db/%s/users/%s' % (db_name, username),
                                  method='POST',
                                  body=json.dumps({'password': password}))

        # Non-existing user
        response_body = 'Invalid username %s' % username
        with self.patch_fetch_mock(client) as m:
            self.setup_fetch_mock(m, 400, body=response_body)
            with self.assertRaisesRegexp(AsyncfluxError, response_body):
                yield user.change_password(password)

            self.assert_mock_args(m, '/db/%s/users/%s' % (db_name, username),
                                  method='POST',
                                  body=json.dumps({'password': password}))

        # Invalid password
        password = 'bar'
        response_body = ('Password must be more than 4 and less than 56 '
                         'characters')
        with self.patch_fetch_mock(client) as m:
            self.setup_fetch_mock(m, 400, body=response_body)
            with self.assertRaisesRegexp(AsyncfluxError, response_body):
                yield user.change_password(password)

            self.assert_mock_args(m, (db_name, username) % '/db/%s/users/%s',
                                  method='POST',
                                  body=json.dumps({'password': password}))
dataset/ETHPy150Open puentesarrin/asyncflux/tests/user_test.py/UserTestCase.test_change_password/swapped operands of `%`