forked from maxcutler/python-wordpress-xmlrpc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
30 lines (23 loc) · 944 Bytes
/
Copy path__init__.py
File metadata and controls
30 lines (23 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import unittest
import collections
from wordpress_xmlrpc import Client
from wordpress_xmlrpc.compat import ConfigParser
class WordPressTestCase(unittest.TestCase):
def setUp(self):
config = ConfigParser()
with open('wp-config.cfg', 'r') as f:
config.readfp(f)
self.xmlrpc_url = config.get('wordpress', 'url')
self.username = config.get('wordpress', 'username')
self.userid = config.get('wordpress', 'userid')
self.client = Client(self.xmlrpc_url,
self.username,
config.get('wordpress', 'password'))
def assert_list_of_classes(self, lst, kls):
"""
Verifies that a list contains objects of a specific class.
"""
self.assertTrue(isinstance(lst, collections.Iterable))
for obj in lst:
self.assertTrue(isinstance(obj, kls))