Exemple #1
0
    def test_pkg_path(self):
        import pyimeji
        from pyimeji.util import pkg_path

        func_test = pkg_path('test.json')
        path_test = os.path.join(os.path.dirname(pyimeji.__file__), 'test.json')
        self.assertEquals(func_test, path_test)
Exemple #2
0
    def test_pkg_path(self):
        import pyimeji
        from pyimeji.util import pkg_path

        func_test = pkg_path('test.json')
        path_test = os.path.join(os.path.dirname(pyimeji.__file__),
                                 'test.json')
        self.assertEquals(func_test, path_test)
Exemple #3
0
# coding=utf8
from __future__ import unicode_literals
from unittest import TestCase
from datetime import datetime
import os

from httmock import all_requests, response, HTTMock

from pyimeji.util import pkg_path, jsonload, jsondumps

SERVICE_URL = 'http://example.org'

RESOURCES = {
    name: jsonload(pkg_path('tests', 'resources', '%s.json' % name))
    for name in ['item', 'collection', 'album', 'profile']
}


class Response(object):
    def __init__(self, key, status, content):
        self.key = key
        self.status = status
        self.content = content


RESPONSES = {}

for path, method, status, content in [
    ('items', 'get', 200, jsondumps([{
        "id": "Wo1JI_oZNyrfxV_t"
    }])),
Exemple #4
0
# coding=utf8
from __future__ import unicode_literals
from unittest import TestCase
from datetime import datetime
import os

from httmock import all_requests, response, HTTMock

from pyimeji.util import pkg_path, jsonload, jsondumps


SERVICE_URL = 'http://example.org'


RESOURCES = {
    name: jsonload(pkg_path('tests', 'resources', '%s.json' % name))
    for name in ['item', 'collection', 'album', 'profile']}


class Response(object):
    def __init__(self, key, status, content):
        self.key = key
        self.status = status
        self.content = content


RESPONSES = {}

for path, method, status, content in [
    ('items', 'get', 200, jsondumps([{"id": "Wo1JI_oZNyrfxV_t"}])),
    ('items', 'post', 201, RESOURCES['item']),