Repository: praw-dev/praw

Issue:
ReDesign: Flair v2 support
## Issue Description

Reddit's ReDesign now has an endpoint for their v2 of the flairtemplates, [link](https://www.reddit.com/dev/api#POST_api_flairtemplate_v2). Adding this support to PRAW would allow us to see the mod-only status of a flair, as well as those additional attributes.

I would love to attempt adding in this support but I don't have capacity for a while.


Discussion:
I'd like to tackle this.
Re-opening this. My PR neglected to add the ability to *set* these flairs on posts or redditors.

I'll submit a PR with these features.

Resolving patch:
diff --git a/praw/models/reddit/subreddit.py b/praw/models/reddit/subreddit.py
--- a/praw/models/reddit/subreddit.py
+++ b/praw/models/reddit/subreddit.py
@@ -926,7 +926,8 @@ def delete_all(self):
         """
         return self.update(x['user'] for x in self())
 
-    def set(self, redditor=None, text='', css_class=''):
+    def set(self, redditor=None, text='', css_class='',
+            flair_template_id=None):
         """Set flair for a Redditor.
 
         :param redditor: (Required) A redditor name (e.g., ``'spez'``) or
@@ -934,7 +935,9 @@ def set(self, redditor=None, text='', css_class=''):
         :param text: The flair text to associate with the Redditor or
             Submission (default: '').
         :param css_class: The css class to associate with the flair html
-            (default: '').
+            (default: ''). Use either this or ``flair_template_id``.
+        :param flair_template_id: The ID of the flair template to be used
+            (default: ``None``). Use either this or ``css_class``.
 
         This method can only be used by an authenticated user who is a
         moderator of the associated Subreddit.
@@ -943,11 +946,23 @@ def set(self, redditor=None, text='', css_class=''):
 
         .. code:: python
 
-           reddit.subreddit('redditdev').flair.set('bboe', 'PRAW author')
+           reddit.subreddit('redditdev').flair.set('bboe', 'PRAW author',
+                                                   css_class='mods')
+           template = '6bd28436-1aa7-11e9-9902-0e05ab0fad46'
+           reddit.subreddit('redditdev').flair.set('spez', 'Reddit CEO',
+                                                   flair_template_id=template)
 
         """
-        data = {'css_class': css_class, 'name': str(redditor), 'text': text}
-        url = API_PATH['flair'].format(subreddit=self.subreddit)
+        if css_class and flair_template_id is not None:
+            raise TypeError('Parameter `css_class` cannot be used in '
+                            'conjunction with `flair_template_id`.')
+        data = {'name': str(redditor), 'text': text}
+        if flair_template_id is not None:
+            data['flair_template_id'] = flair_template_id
+            url = API_PATH['select_flair'].format(subreddit=self.subreddit)
+        else:
+            data['css_class'] = css_class
+            url = API_PATH['flair'].format(subreddit=self.subreddit)
         self.subreddit._reddit.post(url, data=data)
 
     def update(self, flair_list, text='', css_class=''):


Test patch:
diff --git a/tests/integration/cassettes/TestSubredditFlair.test_set__flair_id.json b/tests/integration/cassettes/TestSubredditFlair.test_set__flair_id.json
new file mode 100644
--- /dev/null
+++ b/tests/integration/cassettes/TestSubredditFlair.test_set__flair_id.json
@@ -0,0 +1,222 @@
+{
+  "http_interactions": [
+    {
+      "recorded_at": "2019-01-22T01:07:10",
+      "request": {
+        "body": {
+          "encoding": "utf-8",
+          "string": "grant_type=password&password=<PASSWORD>&username=<USERNAME>"
+        },
+        "headers": {
+          "Accept": [
+            "*/*"
+          ],
+          "Accept-Encoding": [
+            "identity"
+          ],
+          "Authorization": [
+            "Basic <BASIC_AUTH>"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Content-Length": [
+            "53"
+          ],
+          "Content-Type": [
+            "application/x-www-form-urlencoded"
+          ],
+          "User-Agent": [
+            "<USER_AGENT> PRAW/6.1.1.dev0 prawcore/1.0.0"
+          ]
+        },
+        "method": "POST",
+        "uri": "https://www.reddit.com/api/v1/access_token"
+      },
+      "response": {
+        "body": {
+          "encoding": "UTF-8",
+          "string": "{\"access_token\": \"<ACCESS_TOKEN>\", \"token_type\": \"bearer\", \"expires_in\": 3600, \"scope\": \"*\"}"
+        },
+        "headers": {
+          "Accept-Ranges": [
+            "bytes"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Content-Length": [
+            "116"
+          ],
+          "Content-Type": [
+            "application/json; charset=UTF-8"
+          ],
+          "Date": [
+            "Tue, 22 Jan 2019 01:07:10 GMT"
+          ],
+          "Server": [
+            "snooserv"
+          ],
+          "Set-Cookie": [
+            "edgebucket=OlzQpN78XcOI4qNljZ; Domain=reddit.com; Max-Age=63071999; Path=/;  secure"
+          ],
+          "Strict-Transport-Security": [
+            "max-age=15552000; includeSubDomains; preload"
+          ],
+          "Via": [
+            "1.1 varnish"
+          ],
+          "X-Cache": [
+            "MISS"
+          ],
+          "X-Cache-Hits": [
+            "0"
+          ],
+          "X-Moose": [
+            "majestic"
+          ],
+          "X-Served-By": [
+            "cache-pao17430-PAO"
+          ],
+          "X-Timer": [
+            "S1548119230.826199,VS0,VE514"
+          ],
+          "cache-control": [
+            "max-age=0, must-revalidate"
+          ],
+          "x-content-type-options": [
+            "nosniff"
+          ],
+          "x-frame-options": [
+            "SAMEORIGIN"
+          ],
+          "x-xss-protection": [
+            "1; mode=block"
+          ]
+        },
+        "status": {
+          "code": 200,
+          "message": "OK"
+        },
+        "url": "https://www.reddit.com/api/v1/access_token"
+      }
+    },
+    {
+      "recorded_at": "2019-01-22T01:07:10",
+      "request": {
+        "body": {
+          "encoding": "utf-8",
+          "string": "api_type=json&flair_template_id=11c32eee-1482-11e9-bfc0-0efc81a5e8e8&name=<USERNAME>&text=redditor+flair"
+        },
+        "headers": {
+          "Accept": [
+            "*/*"
+          ],
+          "Accept-Encoding": [
+            "identity"
+          ],
+          "Authorization": [
+            "bearer <ACCESS_TOKEN>"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Content-Length": [
+            "98"
+          ],
+          "Content-Type": [
+            "application/x-www-form-urlencoded"
+          ],
+          "Cookie": [
+            "edgebucket=OlzQpN78XcOI4qNljZ"
+          ],
+          "User-Agent": [
+            "<USER_AGENT> PRAW/6.1.1.dev0 prawcore/1.0.0"
+          ]
+        },
+        "method": "POST",
+        "uri": "https://oauth.reddit.com/r/<TEST_SUBREDDIT>/api/selectflair/?raw_json=1"
+      },
+      "response": {
+        "body": {
+          "encoding": "UTF-8",
+          "string": "{\"json\": {\"errors\": []}}"
+        },
+        "headers": {
+          "Accept-Ranges": [
+            "bytes"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Content-Length": [
+            "24"
+          ],
+          "Content-Type": [
+            "application/json; charset=UTF-8"
+          ],
+          "Date": [
+            "Tue, 22 Jan 2019 01:07:10 GMT"
+          ],
+          "Server": [
+            "snooserv"
+          ],
+          "Strict-Transport-Security": [
+            "max-age=15552000; includeSubDomains; preload"
+          ],
+          "Via": [
+            "1.1 varnish"
+          ],
+          "X-Cache": [
+            "MISS"
+          ],
+          "X-Cache-Hits": [
+            "0"
+          ],
+          "X-Moose": [
+            "majestic"
+          ],
+          "X-Served-By": [
+            "cache-pao17430-PAO"
+          ],
+          "X-Timer": [
+            "S1548119230.399917,VS0,VE187"
+          ],
+          "cache-control": [
+            "private, s-maxage=0, max-age=0, must-revalidate, max-age=0, must-revalidate"
+          ],
+          "expires": [
+            "-1"
+          ],
+          "x-content-type-options": [
+            "nosniff"
+          ],
+          "x-frame-options": [
+            "SAMEORIGIN"
+          ],
+          "x-ratelimit-remaining": [
+            "592.0"
+          ],
+          "x-ratelimit-reset": [
+            "170"
+          ],
+          "x-ratelimit-used": [
+            "8"
+          ],
+          "x-ua-compatible": [
+            "IE=edge"
+          ],
+          "x-xss-protection": [
+            "1; mode=block"
+          ]
+        },
+        "status": {
+          "code": 200,
+          "message": "OK"
+        },
+        "url": "https://oauth.reddit.com/r/<TEST_SUBREDDIT>/api/selectflair/?raw_json=1"
+      }
+    }
+  ],
+  "recorded_with": "betamax/0.8.1"
+}
\ No newline at end of file
diff --git a/tests/integration/cassettes/TestSubredditFlair.test_set__flair_id_default_text.json b/tests/integration/cassettes/TestSubredditFlair.test_set__flair_id_default_text.json
new file mode 100644
--- /dev/null
+++ b/tests/integration/cassettes/TestSubredditFlair.test_set__flair_id_default_text.json
@@ -0,0 +1,222 @@
+{
+  "http_interactions": [
+    {
+      "recorded_at": "2019-01-22T01:13:40",
+      "request": {
+        "body": {
+          "encoding": "utf-8",
+          "string": "grant_type=password&password=<PASSWORD>&username=<USERNAME>"
+        },
+        "headers": {
+          "Accept": [
+            "*/*"
+          ],
+          "Accept-Encoding": [
+            "identity"
+          ],
+          "Authorization": [
+            "Basic <BASIC_AUTH>"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Content-Length": [
+            "53"
+          ],
+          "Content-Type": [
+            "application/x-www-form-urlencoded"
+          ],
+          "User-Agent": [
+            "<USER_AGENT> PRAW/6.1.1.dev0 prawcore/1.0.0"
+          ]
+        },
+        "method": "POST",
+        "uri": "https://www.reddit.com/api/v1/access_token"
+      },
+      "response": {
+        "body": {
+          "encoding": "UTF-8",
+          "string": "{\"access_token\": \"<ACCESS_TOKEN>\", \"token_type\": \"bearer\", \"expires_in\": 3600, \"scope\": \"*\"}"
+        },
+        "headers": {
+          "Accept-Ranges": [
+            "bytes"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Content-Length": [
+            "116"
+          ],
+          "Content-Type": [
+            "application/json; charset=UTF-8"
+          ],
+          "Date": [
+            "Tue, 22 Jan 2019 01:13:40 GMT"
+          ],
+          "Server": [
+            "snooserv"
+          ],
+          "Set-Cookie": [
+            "edgebucket=QQWuL3Us2tLU8jHwA9; Domain=reddit.com; Max-Age=63071999; Path=/;  secure"
+          ],
+          "Strict-Transport-Security": [
+            "max-age=15552000; includeSubDomains; preload"
+          ],
+          "Via": [
+            "1.1 varnish"
+          ],
+          "X-Cache": [
+            "MISS"
+          ],
+          "X-Cache-Hits": [
+            "0"
+          ],
+          "X-Moose": [
+            "majestic"
+          ],
+          "X-Served-By": [
+            "cache-pao17422-PAO"
+          ],
+          "X-Timer": [
+            "S1548119620.677279,VS0,VE538"
+          ],
+          "cache-control": [
+            "max-age=0, must-revalidate"
+          ],
+          "x-content-type-options": [
+            "nosniff"
+          ],
+          "x-frame-options": [
+            "SAMEORIGIN"
+          ],
+          "x-xss-protection": [
+            "1; mode=block"
+          ]
+        },
+        "status": {
+          "code": 200,
+          "message": "OK"
+        },
+        "url": "https://www.reddit.com/api/v1/access_token"
+      }
+    },
+    {
+      "recorded_at": "2019-01-22T01:13:40",
+      "request": {
+        "body": {
+          "encoding": "utf-8",
+          "string": "api_type=json&flair_template_id=11c32eee-1482-11e9-bfc0-0efc81a5e8e8&name=<USERNAME>&text="
+        },
+        "headers": {
+          "Accept": [
+            "*/*"
+          ],
+          "Accept-Encoding": [
+            "identity"
+          ],
+          "Authorization": [
+            "bearer <ACCESS_TOKEN>"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Content-Length": [
+            "84"
+          ],
+          "Content-Type": [
+            "application/x-www-form-urlencoded"
+          ],
+          "Cookie": [
+            "edgebucket=QQWuL3Us2tLU8jHwA9"
+          ],
+          "User-Agent": [
+            "<USER_AGENT> PRAW/6.1.1.dev0 prawcore/1.0.0"
+          ]
+        },
+        "method": "POST",
+        "uri": "https://oauth.reddit.com/r/<TEST_SUBREDDIT>/api/selectflair/?raw_json=1"
+      },
+      "response": {
+        "body": {
+          "encoding": "UTF-8",
+          "string": "{\"json\": {\"errors\": []}}"
+        },
+        "headers": {
+          "Accept-Ranges": [
+            "bytes"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Content-Length": [
+            "24"
+          ],
+          "Content-Type": [
+            "application/json; charset=UTF-8"
+          ],
+          "Date": [
+            "Tue, 22 Jan 2019 01:13:40 GMT"
+          ],
+          "Server": [
+            "snooserv"
+          ],
+          "Strict-Transport-Security": [
+            "max-age=15552000; includeSubDomains; preload"
+          ],
+          "Via": [
+            "1.1 varnish"
+          ],
+          "X-Cache": [
+            "MISS"
+          ],
+          "X-Cache-Hits": [
+            "0"
+          ],
+          "X-Moose": [
+            "majestic"
+          ],
+          "X-Served-By": [
+            "cache-pao17433-PAO"
+          ],
+          "X-Timer": [
+            "S1548119620.291392,VS0,VE154"
+          ],
+          "cache-control": [
+            "private, s-maxage=0, max-age=0, must-revalidate, max-age=0, must-revalidate"
+          ],
+          "expires": [
+            "-1"
+          ],
+          "x-content-type-options": [
+            "nosniff"
+          ],
+          "x-frame-options": [
+            "SAMEORIGIN"
+          ],
+          "x-ratelimit-remaining": [
+            "599.0"
+          ],
+          "x-ratelimit-reset": [
+            "380"
+          ],
+          "x-ratelimit-used": [
+            "1"
+          ],
+          "x-ua-compatible": [
+            "IE=edge"
+          ],
+          "x-xss-protection": [
+            "1; mode=block"
+          ]
+        },
+        "status": {
+          "code": 200,
+          "message": "OK"
+        },
+        "url": "https://oauth.reddit.com/r/<TEST_SUBREDDIT>/api/selectflair/?raw_json=1"
+      }
+    }
+  ],
+  "recorded_with": "betamax/0.8.1"
+}
\ No newline at end of file
diff --git a/tests/integration/cassettes/TestSubredditFlair.test_set__redditor_css_only.json b/tests/integration/cassettes/TestSubredditFlair.test_set__redditor_css_only.json
new file mode 100644
--- /dev/null
+++ b/tests/integration/cassettes/TestSubredditFlair.test_set__redditor_css_only.json
@@ -0,0 +1,222 @@
+{
+  "http_interactions": [
+    {
+      "recorded_at": "2019-01-22T01:13:41",
+      "request": {
+        "body": {
+          "encoding": "utf-8",
+          "string": "grant_type=password&password=<PASSWORD>&username=<USERNAME>"
+        },
+        "headers": {
+          "Accept": [
+            "*/*"
+          ],
+          "Accept-Encoding": [
+            "identity"
+          ],
+          "Authorization": [
+            "Basic <BASIC_AUTH>"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Content-Length": [
+            "53"
+          ],
+          "Content-Type": [
+            "application/x-www-form-urlencoded"
+          ],
+          "User-Agent": [
+            "<USER_AGENT> PRAW/6.1.1.dev0 prawcore/1.0.0"
+          ]
+        },
+        "method": "POST",
+        "uri": "https://www.reddit.com/api/v1/access_token"
+      },
+      "response": {
+        "body": {
+          "encoding": "UTF-8",
+          "string": "{\"access_token\": \"<ACCESS_TOKEN>\", \"token_type\": \"bearer\", \"expires_in\": 3600, \"scope\": \"*\"}"
+        },
+        "headers": {
+          "Accept-Ranges": [
+            "bytes"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Content-Length": [
+            "116"
+          ],
+          "Content-Type": [
+            "application/json; charset=UTF-8"
+          ],
+          "Date": [
+            "Tue, 22 Jan 2019 01:13:41 GMT"
+          ],
+          "Server": [
+            "snooserv"
+          ],
+          "Set-Cookie": [
+            "edgebucket=BiIM1LK6SKI5lEcdWS; Domain=reddit.com; Max-Age=63071999; Path=/;  secure"
+          ],
+          "Strict-Transport-Security": [
+            "max-age=15552000; includeSubDomains; preload"
+          ],
+          "Via": [
+            "1.1 varnish"
+          ],
+          "X-Cache": [
+            "MISS"
+          ],
+          "X-Cache-Hits": [
+            "0"
+          ],
+          "X-Moose": [
+            "majestic"
+          ],
+          "X-Served-By": [
+            "cache-pao17444-PAO"
+          ],
+          "X-Timer": [
+            "S1548119621.532980,VS0,VE472"
+          ],
+          "cache-control": [
+            "max-age=0, must-revalidate"
+          ],
+          "x-content-type-options": [
+            "nosniff"
+          ],
+          "x-frame-options": [
+            "SAMEORIGIN"
+          ],
+          "x-xss-protection": [
+            "1; mode=block"
+          ]
+        },
+        "status": {
+          "code": 200,
+          "message": "OK"
+        },
+        "url": "https://www.reddit.com/api/v1/access_token"
+      }
+    },
+    {
+      "recorded_at": "2019-01-22T01:13:41",
+      "request": {
+        "body": {
+          "encoding": "utf-8",
+          "string": "api_type=json&css_class=some+class&name=<USERNAME>&text="
+        },
+        "headers": {
+          "Accept": [
+            "*/*"
+          ],
+          "Accept-Encoding": [
+            "identity"
+          ],
+          "Authorization": [
+            "bearer <ACCESS_TOKEN>"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Content-Length": [
+            "50"
+          ],
+          "Content-Type": [
+            "application/x-www-form-urlencoded"
+          ],
+          "Cookie": [
+            "edgebucket=BiIM1LK6SKI5lEcdWS"
+          ],
+          "User-Agent": [
+            "<USER_AGENT> PRAW/6.1.1.dev0 prawcore/1.0.0"
+          ]
+        },
+        "method": "POST",
+        "uri": "https://oauth.reddit.com/r/<TEST_SUBREDDIT>/api/flair/?raw_json=1"
+      },
+      "response": {
+        "body": {
+          "encoding": "UTF-8",
+          "string": "{\"json\": {\"errors\": []}}"
+        },
+        "headers": {
+          "Accept-Ranges": [
+            "bytes"
+          ],
+          "Connection": [
+            "keep-alive"
+          ],
+          "Content-Length": [
+            "24"
+          ],
+          "Content-Type": [
+            "application/json; charset=UTF-8"
+          ],
+          "Date": [
+            "Tue, 22 Jan 2019 01:13:41 GMT"
+          ],
+          "Server": [
+            "snooserv"
+          ],
+          "Strict-Transport-Security": [
+            "max-age=15552000; includeSubDomains; preload"
+          ],
+          "Via": [
+            "1.1 varnish"
+          ],
+          "X-Cache": [
+            "MISS"
+          ],
+          "X-Cache-Hits": [
+            "0"
+          ],
+          "X-Moose": [
+            "majestic"
+          ],
+          "X-Served-By": [
+            "cache-pao17442-PAO"
+          ],
+          "X-Timer": [
+            "S1548119621.084567,VS0,VE152"
+          ],
+          "cache-control": [
+            "private, s-maxage=0, max-age=0, must-revalidate, max-age=0, must-revalidate"
+          ],
+          "expires": [
+            "-1"
+          ],
+          "x-content-type-options": [
+            "nosniff"
+          ],
+          "x-frame-options": [
+            "SAMEORIGIN"
+          ],
+          "x-ratelimit-remaining": [
+            "598.0"
+          ],
+          "x-ratelimit-reset": [
+            "379"
+          ],
+          "x-ratelimit-used": [
+            "2"
+          ],
+          "x-ua-compatible": [
+            "IE=edge"
+          ],
+          "x-xss-protection": [
+            "1; mode=block"
+          ]
+        },
+        "status": {
+          "code": 200,
+          "message": "OK"
+        },
+        "url": "https://oauth.reddit.com/r/<TEST_SUBREDDIT>/api/flair/?raw_json=1"
+      }
+    }
+  ],
+  "recorded_with": "betamax/0.8.1"
+}
\ No newline at end of file
diff --git a/tests/integration/cassettes/TestSubredditFlair.test_set__submission.json b/tests/integration/cassettes/TestSubredditFlair.test_set__submission.json
deleted file mode 100644
--- a/tests/integration/cassettes/TestSubredditFlair.test_set__submission.json
+++ /dev/null
@@ -1,102 +0,0 @@
-{
-  "http_interactions": [
-    {
-      "recorded_at": "2016-03-21T01:36:49",
-      "request": {
-        "body": {
-          "encoding": "utf-8",
-          "string": "username=<USERNAME>&password=<PASSWORD>&grant_type=password"
-        },
-        "headers": {
-          "Accept": "*/*",
-          "Accept-Encoding": "identity",
-          "Authorization": "Basic <BASIC_AUTH>",
-          "Connection": "keep-alive",
-          "Content-Length": "57",
-          "Content-Type": "application/x-www-form-urlencoded",
-          "User-Agent": "<USER_AGENT> PRAW/4.0.0a1 prawcore/0.0.7"
-        },
-        "method": "POST",
-        "uri": "https://www.reddit.com/api/v1/access_token"
-      },
-      "response": {
-        "body": {
-          "encoding": "UTF-8",
-          "string": "{\"access_token\": \"7302867-ix2jIRrJJPsKGv7af-DR2nstKgY\", \"token_type\": \"bearer\", \"expires_in\": 3600, \"scope\": \"*\"}"
-        },
-        "headers": {
-          "CF-RAY": "286dacd246bf3988-PHX",
-          "Connection": "keep-alive",
-          "Content-Length": "113",
-          "Content-Type": "application/json; charset=UTF-8",
-          "Date": "Mon, 21 Mar 2016 01:36:49 GMT",
-          "Server": "cloudflare-nginx",
-          "Set-Cookie": "__cfduid=dd2fc30efb9f54228c53d811fff7661441458524209; expires=Tue, 21-Mar-17 01:36:49 GMT; path=/; domain=.reddit.com; HttpOnly",
-          "Strict-Transport-Security": "max-age=15552000; includeSubDomains; preload",
-          "X-Moose": "majestic",
-          "cache-control": "max-age=0, must-revalidate",
-          "x-content-type-options": "nosniff",
-          "x-frame-options": "SAMEORIGIN",
-          "x-xss-protection": "1; mode=block"
-        },
-        "status": {
-          "code": 200,
-          "message": "OK"
-        },
-        "url": "https://www.reddit.com/api/v1/access_token"
-      }
-    },
-    {
-      "recorded_at": "2016-03-21T01:36:49",
-      "request": {
-        "body": {
-          "encoding": "utf-8",
-          "string": "api_type=json&text=submission+flair&css_class=&link=t3_4b536p"
-        },
-        "headers": {
-          "Accept": "*/*",
-          "Accept-Encoding": "identity",
-          "Authorization": "bearer 7302867-ix2jIRrJJPsKGv7af-DR2nstKgY",
-          "Connection": "keep-alive",
-          "Content-Length": "61",
-          "Content-Type": "application/x-www-form-urlencoded",
-          "Cookie": "__cfduid=dd2fc30efb9f54228c53d811fff7661441458524209; loidcreated=2016-03-21T01%3A36%3A49.059Z; loid=c7hG8V2HtTkojMRagI",
-          "User-Agent": "<USER_AGENT> PRAW/4.0.0a1 prawcore/0.0.7"
-        },
-        "method": "POST",
-        "uri": "https://oauth.reddit.com/r/<TEST_SUBREDDIT>/api/flair/?raw_json=1"
-      },
-      "response": {
-        "body": {
-          "encoding": "UTF-8",
-          "string": "{\"json\": {\"errors\": []}}"
-        },
-        "headers": {
-          "CF-RAY": "286dacd7351d39be-PHX",
-          "Connection": "keep-alive",
-          "Content-Length": "24",
-          "Content-Type": "application/json; charset=UTF-8",
-          "Date": "Mon, 21 Mar 2016 01:36:49 GMT",
-          "Server": "cloudflare-nginx",
-          "Strict-Transport-Security": "max-age=15552000; includeSubDomains; preload",
-          "X-Moose": "majestic",
-          "cache-control": "private, s-maxage=0, max-age=0, must-revalidate",
-          "expires": "-1",
-          "x-content-type-options": "nosniff",
-          "x-frame-options": "SAMEORIGIN",
-          "x-ratelimit-remaining": "598.0",
-          "x-ratelimit-reset": "191",
-          "x-ratelimit-used": "2",
-          "x-ua-compatible": "IE=edge",
-          "x-xss-protection": "1; mode=block"
-        },
-        "status": {
-          "code": 200,
-          "message": "OK"
-        },
-        "url": "https://oauth.reddit.com/r/<TEST_SUBREDDIT>/api/flair/?raw_json=1"
-      }
-    }
-  ],
-  "recorded_with": "betamax/0.5.1"
-}
\ No newline at end of file
diff --git a/tests/integration/models/reddit/test_subreddit.py b/tests/integration/models/reddit/test_subreddit.py
--- a/tests/integration/models/reddit/test_subreddit.py
+++ b/tests/integration/models/reddit/test_subreddit.py
@@ -498,6 +498,23 @@ def test_delete_all(self, _):
             assert len(response) > 100
             assert all('removed' in x['status'] for x in response)
 
+    def test_set__flair_id(self):
+        self.reddit.read_only = False
+        with self.recorder.use_cassette(
+                'TestSubredditFlair.test_set__flair_id'):
+            redditor = self.reddit.redditor(self.reddit.config.username)
+            flair = '11c32eee-1482-11e9-bfc0-0efc81a5e8e8'
+            self.subreddit.flair.set(redditor, 'redditor flair',
+                                     flair_template_id=flair)
+
+    def test_set__flair_id_default_text(self):
+        self.reddit.read_only = False
+        with self.recorder.use_cassette(
+                'TestSubredditFlair.test_set__flair_id_default_text'):
+            redditor = self.reddit.redditor(self.reddit.config.username)
+            flair = '11c32eee-1482-11e9-bfc0-0efc81a5e8e8'
+            self.subreddit.flair.set(redditor, flair_template_id=flair)
+
     def test_set__redditor(self):
         self.reddit.read_only = False
         with self.recorder.use_cassette(
@@ -506,6 +523,13 @@ def test_set__redditor(self):
                 self.reddit.config.username)
             self.subreddit.flair.set(redditor, 'redditor flair')
 
+    def test_set__redditor_css_only(self):
+        self.reddit.read_only = False
+        with self.recorder.use_cassette(
+                'TestSubredditFlair.test_set__redditor_css_only'):
+            self.subreddit.flair.set(self.reddit.config.username,
+                                     css_class='some class')
+
     def test_set__redditor_string(self):
         self.reddit.read_only = False
         with self.recorder.use_cassette(
@@ -513,13 +537,6 @@ def test_set__redditor_string(self):
             self.subreddit.flair.set(self.reddit.config.username, 'new flair',
                                      'some class')
 
-    def test_set__submission(self):
-        self.reddit.read_only = False
-        with self.recorder.use_cassette(
-                'TestSubredditFlair.test_set__submission'):
-            submission = self.subreddit._reddit.submission('4b536p')
-            self.subreddit.flair.set(submission, 'submission flair')
-
     def test_update(self):
         self.reddit.read_only = False
         redditor = self.subreddit._reddit.redditor(self.reddit.config.username)
diff --git a/tests/unit/models/reddit/test_subreddit.py b/tests/unit/models/reddit/test_subreddit.py
--- a/tests/unit/models/reddit/test_subreddit.py
+++ b/tests/unit/models/reddit/test_subreddit.py
@@ -92,6 +92,14 @@ def test_submit_failure(self):
         assert str(excinfo.value) == message
 
 
+class TestSubredditFlair(UnitTest):
+    def test_set(self):
+        subreddit = self.reddit.subreddit(pytest.placeholders.test_subreddit)
+        with pytest.raises(TypeError):
+            subreddit.flair.set('a_redditor', css_class='myCSS',
+                                flair_template_id='gibberish')
+
+
 class TestSubredditFlairTemplates(UnitTest):
     def test_bad_add(self):
         subreddit = self.reddit.subreddit(pytest.placeholders.test_subreddit)