Repository: mwanjajoel/django-momoapi (language: python)

Issue:
chore(travis) - Configure .travis.yml file.
# Configure Travis.

- Add travis configurations. [Closes #1](https://github.com/mwanjajoel/django-momoapi/issues/1)

## Description

- Add travis configurations to .travis.yml file.
- Add coverage to the requirements.
- Set default value for database to momo in settings.py file.


## Motivation and Context
- Change sets up continuous integration using travis. 

https://github.com/mwanjajoel/django-momoapi/issues/1

## How Has This Been Tested?
- I have tested this on my personal travis account. 
- For tests to successfully run you need to set env variables within travis. 

## Screenshots (if appropriate):
![Screenshot from 2020-02-28 22-06-30](https://user-images.githubusercontent.com/17021137/75579409-c8d0f680-5a76-11ea-8682-3f4417f2548a.png)

## Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist:
- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.

Add CI using Travis
There is Continuous Integration at the moment


Discussion / hints:

Fix patch:
diff --git a/.coveragerc b/.coveragerc
new file mode 100644
index 0000000..ccfa374
--- /dev/null
+++ b/.coveragerc
@@ -0,0 +1,4 @@
+[run]
+omit =
+    env/*
+    tests/*
\ No newline at end of file
diff --git a/.env_example b/.env_example
index 73f9ee8..f0b78a3 100644
--- a/.env_example
+++ b/.env_example
@@ -1,2 +1,9 @@
 SECRET_KEY= # SECRET_KEY
-DEBUG= #true for development dont sent in production
\ No newline at end of file
+DEBUG= #true for development dont sent in production
+DB_NAME= # database name
+DB_HOST= # database host
+DB_USER= # database user
+DB_PASSWORD= # database password
+DB_PORT = # database port
+CODECOV_TOKEN = # codecov token 
+
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..886b9c4
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,17 @@
+language: python
+python:
+- '3.7'
+services:
+- postgresql
+addons:
+  postgresql: '9.4'
+before_script:
+- pip install -r requirements.txt
+- psql -c 'create database momo;' -U postgres
+- python manage.py makemigrations --dry-run
+- python manage.py migrate
+script:
+- pytest
+env:
+  global:
+    secure: lyrPSV14XBHGVmo1KQT59rnb3k3Cg8WQTl1K3W7vtBqBxAWQ6EJAXyqCbvv6zte6oz1D/fgROAKX/EraQdZEGhBzIWoe4vbuK3zdG9PwQFa9IhNUx6oF6UsmFTCpmC71T352XyNKrrvd06KTtzvJkyS4wySMVQpo/jRVevaYDNw/B1sjkw6GiKp4RuKCRsU5FHXCBX5+8Kc9gIpz48IhEKrudHlctYWBXzMA/Ing8T5KItzaTAomqs3xAgoINzKGdMdakwjkc1maq53d3TpTupQubx6V7Pkr4ZVbJO1QKfWJiTqGiZ+4ACeaBfXLslRvqwRjGw2lBzWsT+rAS/EoXwCsK1e3xhwRjzHTqpbOOFw4Tl6OlPbbEsikrRxJ8JibhVK1IVagX0EJVETvYwMTUG6MQYWRFSHLX/6K3+27XnsdEkfvVedUplIEpU7P86CZ9TjrrTpe7XE3iFmTehcZ1XfXEYDcngQNdeM4AJtQ3FX6rxb70iA9skhAgselBGAd0O7gAx1SJSK8ddIvXkkzXlNiq4lSURZ2/acC5Up7obNZt01i1Rc3RIoXCns3PyZnaM6XbIR7OedN/wYPichUvnBFxW2Npwt+vSmT1VMXu1kIFuWGDyCj1HtMvzkdSlrV7+zIg9Ktbt8ptbvVKTLtRQVTx2VN3EYGz/Yuq/ORi9A=
diff --git a/AUTHORS.md b/AUTHORS.md
new file mode 100644
index 0000000..34ab81d
--- /dev/null
+++ b/AUTHORS.md
@@ -0,0 +1,5 @@
+# Authors for the Django MoMo API App. 
+
+- Mwanja Joel [(@mrmwanjajoel)](https://twitter.com/mrjoelmwanja)
+
+- Arthur Nangai [(@arthurnangai)](https://twitter.com/arthurnangai)
\ No newline at end of file
diff --git a/README.md b/README.md
index 3f3d46d..cfbef17 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,10 @@
-<p align="center">
-    <a href="https://twitter.com/mrjoelmwanja">
-        <img src="https://img.shields.io/badge/Contact-@mrjoelmwanja-brightgreen.svg?style=flat" alt="Twitter: @mrjoelmwanja" />
-    </a>
-</p>
 
 # Django MoMo API 
-This is a django package for the MTN MoMo API. It can be added to your current django-based application so as to interact with the MTN MoMo API in a much simpler way. 
+This is a django package for the MTN MoMo API. It can be added to your current django-based application so as to interact with the MTN MoMo API in a much simpler way.
+
+![Build Status](https://travis-ci.com/mwanjajoel/django-momoapi.svg?branch=develop) 
+
+
 
 ## Why we created the Django MoMo API Package
 MTN Uganda released API documentation to their Mobile Money service and integrations for Python, NodeJS, PHP, Java etc have been created but at the time of writing, there is no django package and yet Django is a popular Python based web framework. 
@@ -15,7 +14,12 @@ MTN Uganda released API documentation to their Mobile Money service and integrat
 pip install django-momoapi 
 ```
 ## Development Setup
-
+```
+- Create .env file following the .env_example.
+- Create a postgre database and its credentials to the .env file.
+- Run migrations using the command python manage.py migrate
+- Run application using the command python manage.py runserver
+```
 
 ## How to submit an issue
 
@@ -30,8 +34,9 @@ We follow a strict code of conduct and you can read it [Here](CODE_OF_CONDUCT.md
 
 ## Credits
 
-Django MoMo API package was designed and built by Mwanja Joel, and is copyright © Mwanja Joel 2020. Django MoMo API is licensed under the MIT license; for the full license please see the [LICENSE](LICENSE) file.
+Django MoMo API package was designed and built by Mwanja Joel, and is copyright © Mwanja Joel 2020. Django MoMo API is licensed under the MIT license; for the full license please see the [LICENSE](LICENSE) file. 
 
+Please see the [AUTHORS](AUTHORS) file for the full list of contributors. 
 
 If you find Django MoMo API useful and want to reach out, find me on Twitter: [@mrjoelmwanja](https://twitter.com/mrjoelmwanja).
 
diff --git a/djangomomoapi/settings.py b/djangomomoapi/settings.py
index 0dec348..ed0e571 100644
--- a/djangomomoapi/settings.py
+++ b/djangomomoapi/settings.py
@@ -28,7 +28,7 @@
 # SECURITY WARNING: don't run with debug turned on in production!
 DEBUG = os.getenv('DEBUG')
 
-ALLOWED_HOSTS = []
+ALLOWED_HOSTS = ["*"]
 
 
 # Application definition
@@ -40,6 +40,8 @@
     'django.contrib.sessions',
     'django.contrib.messages',
     'django.contrib.staticfiles',
+
+    'momo',
 ]
 
 MIDDLEWARE = [
@@ -78,12 +80,15 @@
 
 DATABASES = {
     'default': {
-        'ENGINE': 'django.db.backends.sqlite3',
-        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
+        'ENGINE': 'django.db.backends.postgresql',
+        'NAME': os.environ.get('DB_NAME'),
+        'HOST': os.environ.get('DB_HOST'),
+        'USER': os.environ.get('DB_USER'),
+        'PASSWORD': os.environ.get('DB_PASSWORD'),
+        'PORT': os.environ.get('DB_PORT'),
     }
 }
 
-
 # Password validation
 # https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
 
diff --git a/momo/__init__.py b/momo/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/momo/admin.py b/momo/admin.py
new file mode 100644
index 0000000..8c38f3f
--- /dev/null
+++ b/momo/admin.py
@@ -0,0 +1,3 @@
+from django.contrib import admin
+
+# Register your models here.
diff --git a/momo/apps.py b/momo/apps.py
new file mode 100644
index 0000000..2ec91e8
--- /dev/null
+++ b/momo/apps.py
@@ -0,0 +1,5 @@
+from django.apps import AppConfig
+
+
+class MomoConfig(AppConfig):
+    name = 'momo'
diff --git a/momo/migrations/__init__.py b/momo/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/momo/models.py b/momo/models.py
new file mode 100644
index 0000000..b096caa
--- /dev/null
+++ b/momo/models.py
@@ -0,0 +1,4 @@
+from django.db import models
+
+# Create your models here.
+
diff --git a/momo/views.py b/momo/views.py
new file mode 100644
index 0000000..91ea44a
--- /dev/null
+++ b/momo/views.py
@@ -0,0 +1,3 @@
+from django.shortcuts import render
+
+# Create your views here.
diff --git a/requirements.txt b/requirements.txt
index 9829617..c98bc3e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,17 +1,29 @@
 asgiref==3.2.3
+attrs==20.1.0
 autopep8==1.5
-bleach==3.1.0
+bleach==3.1.1
 bumpversion==0.5.3
 certifi==2019.11.28
 chardet==3.0.4
+coverage==5.0.3
 Django==3.0.3
 docutils==0.16
 idna==2.8
 importlib-metadata==1.5.0
+iniconfig==1.0.1
 keyring==21.1.0
+more-itertools==8.4.0
+packaging==20.4
 pkginfo==1.5.0.1
+pluggy==0.13.1
+psycopg2-binary==2.8.4
+py==1.9.0
 pycodestyle==2.5.0
 Pygments==2.5.2
+pyparsing==2.4.7
+pytest==6.0.1
+pytest-cov==2.10.1
+pytest-django==3.9.0
 python-dotenv==0.11.0
 pytz==2019.3
 readme-renderer==24.0
@@ -19,6 +31,7 @@ requests==2.22.0
 requests-toolbelt==0.9.1
 six==1.14.0
 sqlparse==0.3.0
+toml==0.10.1
 tqdm==4.42.1
 twine==3.1.1
 urllib3==1.25.8


Test patch:
diff --git a/momo/tests.py b/momo/tests.py
new file mode 100644
index 0000000..7ce503c
--- /dev/null
+++ b/momo/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/pytest.ini b/pytest.ini
new file mode 100644
index 0000000..9adf763
--- /dev/null
+++ b/pytest.ini
@@ -0,0 +1,3 @@
+[pytest]
+DJANGO_SETTINGS_MODULE = djangomomoapi.settings
+python_files = tests.py test_*.py *_tests.py
\ No newline at end of file
diff --git a/tests/unit/test_create_user.py b/tests/unit/test_create_user.py
new file mode 100644
index 0000000..433ff39
--- /dev/null
+++ b/tests/unit/test_create_user.py
@@ -0,0 +1,5 @@
+import pytest
+
+# create a simple Pytest 
+def test_user_create():
+    pass
\ No newline at end of file