diff --git a/.coverage b/.coverage new file mode 100644 index 0000000..8055c98 --- /dev/null +++ b/.coverage @@ -0,0 +1 @@ +!coverage.py: This is a private format, don't read it directly!{"lines":{"/Users/kasule/Desktop/ug_dst/rwalocation/main.py":[4,6,7,9,10,15,19,24,27,37,11,12,13]}} \ No newline at end of file diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..d05ea96 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,2 @@ +[run] +omit = rwalocation/*__init__.py* \ No newline at end of file diff --git a/.coveralls.yml b/.coveralls.yml new file mode 100644 index 0000000..079257c --- /dev/null +++ b/.coveralls.yml @@ -0,0 +1,2 @@ +service_name: travis-pro +repo_token: hNQRU4lW5bJspVgvbN5ED9c3jfNrmFMNw \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d9b129b --- /dev/null +++ b/.travis.yml @@ -0,0 +1,13 @@ +language: python + +python: + - "3.6" + +install: + - pip install -r requirements.txt + - pip install coveralls + +script: coverage run --source rwalocation rwalocation/main.py + +after_success: + coveralls \ No newline at end of file diff --git a/README.md b/README.md index f4d2165..4469f7b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Rwalocation +[![Coverage Status](https://coveralls.io/repos/github/Kasulejoseph/Ahantu/badge.svg?branch=tests)](https://coveralls.io/github/Kasulejoseph/Ahantu?branch=tests) > A Python library for listing locations in Rwanda ``` diff --git a/rwalocation/main.py b/rwalocation/main.py index 8a98c26..0080e3e 100644 --- a/rwalocation/main.py +++ b/rwalocation/main.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -__version__ = "1.0" +__version__ = "1.1" import requests import operator diff --git a/tests/test_project.py b/tests/test_project.py index ebc8d8c..3ab2ef0 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -2,12 +2,26 @@ # -*- coding: utf-8 -*- import unittest -import ug-dst +from rwalocation.main import Province class UnitTests(unittest.TestCase): + def setUp(self): + self.location = Province() + def test_import(self): - self.assertIsNotNone(ug-dst) + self.assertIsNotNone(self.location) + + def test_list_districts(self): + self.assertIsInstance(self.location.district(), list) + + def test_list_province_not_zero(self): + self.assertNotEqual(len(self.location.province()), 0) + + def test_list_province_return_list(self): + self.assertIsInstance(self.location.province(), list) + + def test_sort_by_district_return_an_array(self): + self.assertIsInstance(self.location.sort_by_district(), list) - def test_project(self): - self.assertTrue(False, "write more tests here") \ No newline at end of file + \ No newline at end of file