Skip to content

Commit

Permalink
Use unicode literals from the _future_ package
Browse files Browse the repository at this point in the history
  • Loading branch information
Christof Debaes committed Oct 16, 2020
1 parent 75e2230 commit a8c70f9
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions freshdesk/v2/tests/test_solutions.py
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import json
import os.path
Expand All @@ -23,17 +24,17 @@ def solution_category(api):


def test_solution_category_str(solution_category):
assert str(solution_category) == u"General Category"
assert str(solution_category) == 'General Category'


def test_solution_category_repr(solution_category):
assert repr(solution_category) == u"<SolutionCategory 'General Category' #%d>" % TEST_CATEGORY
assert repr(solution_category) == "<SolutionCategory 'General Category' #%d>" % TEST_CATEGORY


def test_get_solution_category(solution_category):
assert isinstance(solution_category, SolutionCategory)
assert solution_category.id == TEST_CATEGORY
assert solution_category.name == u'General Category'
assert solution_category.name == 'General Category'
assert isinstance(solution_category.created_at, datetime.datetime)
assert isinstance(solution_category.updated_at, datetime.datetime)

Expand All @@ -45,7 +46,7 @@ def test_get_solution_category_translated(api, solution_category):
category_fr = api.solutions.categories.get_category_translated(TEST_CATEGORY, 'fr')
assert isinstance(category_fr, SolutionCategory)
assert category_fr.id == solution_category.id
assert category_fr.name == u'Catégorie générale'
assert category_fr.name == 'Catégorie générale'
# we want to test whether the translated category was made after the original
assert isinstance(category_fr.created_at, datetime.datetime)
assert category_fr.created_at > solution_category.created_at
Expand All @@ -65,17 +66,17 @@ def solution_folder(api):


def test_solution_folder_str(solution_folder):
assert str(solution_folder) == u'Getting Started'
assert str(solution_folder) == 'Getting Started'


def test_solution_folder_repr(solution_folder):
assert repr(solution_folder) == u"<SolutionFolder 'Getting Started' #%d>" % TEST_FOLDER
assert repr(solution_folder) == "<SolutionFolder 'Getting Started' #%d>" % TEST_FOLDER


def test_get_solution_folder(solution_folder):
assert isinstance(solution_folder, SolutionFolder)
assert solution_folder.id == TEST_FOLDER
assert solution_folder.name == u'Getting Started'
assert solution_folder.name == 'Getting Started'
assert isinstance(solution_folder.created_at, datetime.datetime)
assert isinstance(solution_folder.updated_at, datetime.datetime)

Expand All @@ -84,7 +85,7 @@ def test_get_solution_folder_translated(api, solution_folder):
folder_fr = api.solutions.folders.get_folder_translated(TEST_FOLDER, 'fr')
assert isinstance(folder_fr, SolutionFolder)
assert folder_fr.id == solution_folder.id
assert folder_fr.name == u'Commencer'
assert folder_fr.name == 'Commencer'
# we want to test whether the translated folder was made after the original
assert isinstance(folder_fr.created_at, datetime.datetime)
assert folder_fr.created_at > solution_folder.created_at
Expand All @@ -105,33 +106,33 @@ def test_list_solution_folders_translated(api, solution_folder):
assert len(folders) == 1
assert isinstance(folders[0], SolutionFolder)
assert folders[0].id == TEST_FOLDER
assert folders[0].name == u'Commencer'
assert folders[0].name == 'Commencer'

@pytest.fixture
def solution_article(api):
return api.solutions.articles.get_article(TEST_ARTICLE)


def test_solution_article_str(solution_article):
assert str(solution_article) == u'Changing account details'
assert str(solution_article) == 'Changing account details'


def test_solution_folder_repr(solution_article):
assert repr(solution_article) == u"<SolutionArticle 'Changing account details' #%d>" % TEST_ARTICLE
assert repr(solution_article) == "<SolutionArticle 'Changing account details' #%d>" % TEST_ARTICLE


def test_get_solution_article(solution_article):
assert isinstance(solution_article, SolutionArticle)
assert solution_article.id == TEST_ARTICLE
assert solution_article.title == u'Changing account details'
assert solution_article.status == u'published'
assert solution_article.title == 'Changing account details'
assert solution_article.status == 'published'
assert solution_article.agent_id == 432
assert solution_article.folder_id == TEST_FOLDER
assert solution_article.category_id == TEST_CATEGORY
assert isinstance(solution_article.created_at, datetime.datetime)
assert isinstance(solution_article.updated_at, datetime.datetime)
assert u'foo' in solution_article.tags
assert u'bar' in solution_article.tags
assert 'foo' in solution_article.tags
assert 'bar' in solution_article.tags
assert solution_article.seo_data['meta_title'] == 'seo_account'
assert solution_article.seo_data['meta_description'] == 'seo_account_description'

Expand All @@ -140,7 +141,7 @@ def test_get_solution_article_translated(api, solution_article):
article_fr = api.solutions.articles.get_article_translated(TEST_ARTICLE, 'fr')
assert isinstance(article_fr, SolutionArticle)
assert article_fr.id == solution_article.id
assert article_fr.title == u'Modifier les détails du compte'
assert article_fr.title == 'Modifier les détails du compte'
# we want to test whether the translated solution article was made after the original
assert isinstance(article_fr.created_at, datetime.datetime)
assert article_fr.created_at > solution_article.created_at
Expand All @@ -162,4 +163,4 @@ def test_list_solution_articles_translated(api, solution_article):
assert isinstance(articles_fr[0], SolutionArticle)
assert articles_fr[0].id == TEST_ARTICLE
assert articles_fr[0].id == solution_article.id
assert articles_fr[0].title == u'Modifier les détails du compte'
assert articles_fr[0].title == 'Modifier les détails du compte'

0 comments on commit a8c70f9

Please sign in to comment.