diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..119006c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: python +python: + - "3.6" + +install: + - pip install -r requirements.txt + +script: + - python -m unittest discover + - coverage erase + - coverage run -m pytest && coverage html + +after_success: + - codecov \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index c45bdc9..701e6ee 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ Flask Flask-BasicAuth codecov pylint +pytest diff --git a/tests/test_flaskapp.py b/tests/test_flaskapp.py index e3aac5c..a09c814 100644 --- a/tests/test_flaskapp.py +++ b/tests/test_flaskapp.py @@ -15,12 +15,20 @@ def test_unauthorized(self): def test_multiply(self): response = self.app.get('/multiply?x=5&y=7') - resp = json.loads(response.data) + resp = json.loads(response.data.decode()) self.assertEqual(resp['answer'],35,'Multiply endpoint failed known answer 7*5 = 35') + def test_touppercase(self): + response = self.app.get('/touppercase?s=jantine') + self.assertEqual(response.data.decode(), 'JANTINE', 'Touppercase endpoint failed known answer is JANTINE') # TODO DEFINE TWO MORE TESTS ON THE END POINTS + def test_touppercase2(self): + response = self.app.get('/touppercase?s=jantine') + self.assertEqual(response.data.decode(), 'JANTINE', 'Touppercase endpoint failed known answer is JANTINE') + # TODO DEFINE TWO MORE TESTS ON THE END POINTS + if __name__ == '__main__': unittest.main()