Skip to content

Commit

Permalink
test that v3lite uses cache
Browse files Browse the repository at this point in the history
  • Loading branch information
cleder committed Dec 10, 2014
1 parent f196fc7 commit 6a4c6fe
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
11 changes: 11 additions & 0 deletions docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

0.2 (2014/12/10)
-----------------

- add v3 lite api


0.1 (2014/12/09)
-----------------

- intial version on Pypi - only v3pro api partially implemented
10 changes: 9 additions & 1 deletion duedil/test_lite.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import unittest

from .cache import Cache
from .v3lite import Client, Company

API_KEY = 'hnkc6ew2pbua2mf296kq8yaa'
Expand Down Expand Up @@ -50,11 +51,18 @@ def test_lazy_load(self):
company = Company(API_KEY, company_number='06999618')
self.assertEqual(len(company.__dict__), 4)
self.assertNotEqual(len(company.category), 0)
self.assertNotEqual(len(company.__dict__), 4)
self.assertEqual(len(company.__dict__), 17)
self.assertEqual(company.name, 'DUEDIL LIMITED')
postcode = company.registered_address['postcode']
self.assertEqual(postcode, 'WC1R 4AG')

def test_cache(self):
cache = Cache()
company = Company(API_KEY, company_number='06999618', cache=cache)
self.assertIsNone(cache.get_url(company.url))
self.assertIsInstance(company.get(), dict)
self.assertIsInstance(cache.get_url(company.url), dict)


def test_suite():
suite = unittest.TestSuite()
Expand Down
25 changes: 15 additions & 10 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sys, os
import os
import sys

from setuptools import find_packages, setup
from setuptools.command.test import test as test_command


class PyTest(test_command):

class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
test_command.finalize_options(self)
self.test_args = []
self.test_suite = True

Expand All @@ -16,17 +19,19 @@ def run_tests(self):
sys.exit(errno)


version = '0.1'
version = '0.2'

setup(name='duedil',
version=version,
description="Duedil API client",
long_description=(
open("README.rst").read() + "\n" +
open(os.path.join("docs", "HISTORY.txt")).read() + "\n" +
open(os.path.join("docs", "TODO.txt")).read()
open("README.rst").read() + "\n" +
open(os.path.join("docs", "HISTORY.txt")).read() + "\n" +
open(os.path.join("docs", "TODO.txt")).read()
),
classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[],
# Get strings from
# http://pypi.python.org/pypi?%3Aaction=list_classifiers
keywords='duedil, api',
author='Christian Ledermann',
author_email='christian.ledermann@gmail.com',
Expand Down

0 comments on commit 6a4c6fe

Please sign in to comment.