Example #1
0
    def test_taxonomy_fields_match(self):
        """
        Check that the fields returned by singular and plural versions are the same.
        """
        tax1 = self.client.call(taxonomies.GetTaxonomy('category'))
        tax2 = None

        # find category taxonomy in the list of all taxonomies
        taxs = self.client.call(taxonomies.GetTaxonomies())
        for tax in taxs:
            if tax.name == 'category':
                tax2 = tax
                break
        self.assertTrue(tax2 is not None)

        # compare the two field-by-field
        for field in tax1.definition.keys():
            self.assertEqual(getattr(tax1, field), getattr(tax2, field))
driver.quit()

#epub_data = (1,"a")
#mobi_data = (1,"a")
#a4_pdf_data = (1,"a")
#six_inch_pdf_data = (1,"a")

#print(book_title_in_english)

#For security, consider creating a user just for your script.

wp = Client('http://freetamilebooks.com/xmlrpc.php', fte_username,
            fte_password)
post = WordPressPost()

taxes = wp.call(taxonomies.GetTaxonomies())
#print(taxes)

with urllib.request.urlopen(cover_url) as response, open(cover_image,
                                                         'wb') as out_file:
    shutil.copyfileobj(response, out_file)
#print("Downloaded Cover Image")

filename = cover_image

data = {
    'name': filename,
    'type': 'image/jpeg',  # mimetype
}

# read the binary file and let the XMLRPC library encode it into base64
Example #3
0
 def index_taxonomies(self):
     for taxonomy in self.client.call(taxonomies.GetTaxonomies()):
         self.taxonomies.update({
             taxonomy.name:
             self.client.call(taxonomies.GetTerms(taxonomy.name))
         })
Example #4
0
 def test_get_taxonomies(self):
     taxs = self.client.call(taxonomies.GetTaxonomies())
     self.assert_list_of_classes(taxs, WordPressTaxonomy)