def test_view_new_grant(self):
        inmap = self.std_map()
        inmap['schema public'].update({'view v1': {
            'definition': " SELECT now()::date AS today;",
            'owner': self.db.user,
            'privileges': [{self.db.user: ['all']}, {'user1': ['select']}]}})
        sql = sorted(self.to_sql(inmap, ["CREATE VIEW v1 AS "
                                         "SELECT now()::date AS today"]))
        assert len(sql) == 2
        assert sql[0] == "GRANT ALL ON TABLE v1 TO %s" % self.db.user
        assert sql[1] == "GRANT SELECT ON TABLE v1 TO user1"
Grant privileges on an existing view
dataset/ETHPy150Open perseas/Pyrseas/tests/dbobject/test_privs.py/PrivilegeToSqlTestCase.test_view_new_grant