Repository: mgpai22/ergpy (language: python)

Issue:
Automated tests
**Is your feature request related to a problem? Please describe.**
In order to validate our developments, tests are needed and if they are automated it would be the best

**Describe the solution you'd like**
_GitHub Actions_ allows us to execute code on runners hosted by _GitHub_.

We can write some tests in a `/tests` folder in order to validate the whole behavior of the package by writing deterministic code and checking with `assert` statements.

**Additional context**
- GitHub Actions : https://github.com/features/actions
- Python 3.8 `assert` documentation : https://docs.python.org/3.8/reference/simple_stmts.html#the-assert-statement


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
new file mode 100644
index 0000000..c40d187
--- /dev/null
+++ b/.github/workflows/ci.yaml
@@ -0,0 +1,50 @@
+name: 'Continuous Integration'
+
+on:
+  pull_request:
+    types:
+      - opened
+    branches:
+      - main
+      - dev
+
+jobs:
+  build:
+    strategy:
+      matrix:
+        platform: [ubuntu-20.04]
+    runs-on: ${{ matrix.platform }}
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        with:
+          python-version: '3.8'
+      - run: sh tests/package/package.sh
+
+  quality:
+    needs: build
+    strategy:
+      matrix:
+        platform: [ubuntu-20.04]
+    runs-on: ${{ matrix.platform }}
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        with:
+          python-version: '3.8'
+      - run: sh tests/package/package.sh
+      - run: sh tests/quality/lint.sh
+
+  integration:
+    needs: build
+    strategy:
+      matrix:
+        platform: [ubuntu-20.04]
+    runs-on: ${{ matrix.platform }}
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        with:
+          python-version: '3.8'
+      - run: sh tests/package/package.sh
+      - run: python tests/integration/test_helper_functions.py
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 1f9e4a3..48725e6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -142,3 +142,6 @@ dmypy.json
 
 # Cython debug symbols
 cython_debug/
+
+# User defined
+.idea
diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 13566b8..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Editor-based HTTP Client requests
-/httpRequests/
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
diff --git a/.idea/ergpy.iml b/.idea/ergpy.iml
deleted file mode 100644
index 8e5446a..0000000
--- a/.idea/ergpy.iml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module type="PYTHON_MODULE" version="4">
-  <component name="NewModuleRootManager">
-    <content url="file://$MODULE_DIR$">
-      <excludeFolder url="file://$MODULE_DIR$/venv" />
-    </content>
-    <orderEntry type="inheritedJdk" />
-    <orderEntry type="sourceFolder" forTests="false" />
-  </component>
-  <component name="PyDocumentationSettings">
-    <option name="format" value="PLAIN" />
-    <option name="myDocStringFormat" value="Plain" />
-  </component>
-</module>
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index c548b16..0000000
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<component name="InspectionProjectProfileManager">
-  <profile version="1.0">
-    <option name="myName" value="Project Default" />
-    <inspection_tool class="DuplicatedCode" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
-    <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
-    <inspection_tool class="PyInterpreterInspection" enabled="false" level="WARNING" enabled_by_default="false" />
-    <inspection_tool class="PyPackageRequirementsInspection" enabled="false" level="WARNING" enabled_by_default="false">
-      <option name="ignoredPackages">
-        <value>
-          <list size="7">
-            <item index="0" class="java.lang.String" itemvalue="argparse" />
-            <item index="1" class="java.lang.String" itemvalue="certifi" />
-            <item index="2" class="java.lang.String" itemvalue="pytz" />
-            <item index="3" class="java.lang.String" itemvalue="requests" />
-            <item index="4" class="java.lang.String" itemvalue="gunicorn" />
-            <item index="5" class="java.lang.String" itemvalue="jpype" />
-            <item index="6" class="java.lang.String" itemvalue="org" />
-          </list>
-        </value>
-      </option>
-    </inspection_tool>
-    <inspection_tool class="PyPep8Inspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
-      <option name="ignoredErrors">
-        <list>
-          <option value="E261" />
-          <option value="E501" />
-          <option value="E402" />
-        </list>
-      </option>
-    </inspection_tool>
-    <inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
-      <option name="ignoredErrors">
-        <list>
-          <option value="N802" />
-          <option value="N806" />
-          <option value="N803" />
-        </list>
-      </option>
-    </inspection_tool>
-    <inspection_tool class="PyRedeclarationInspection" enabled="false" level="WARNING" enabled_by_default="false" />
-    <inspection_tool class="PyShadowingBuiltinsInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
-      <option name="ignoredNames">
-        <list>
-          <option value="hash" />
-        </list>
-      </option>
-    </inspection_tool>
-    <inspection_tool class="PyUnboundLocalVariableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
-    <inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
-      <option name="ignoredIdentifiers">
-        <list>
-          <option value="jpype.shutdownJVM" />
-          <option value="org.ergoplatform.appkit.getErgoAddress.script" />
-          <option value="org.ergoplatform.appkit.getId.toString" />
-          <option value="appkit.*" />
-          <option value="jpype.startJVM" />
-        </list>
-      </option>
-    </inspection_tool>
-  </profile>
-</component>
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
deleted file mode 100644
index 105ce2d..0000000
--- a/.idea/inspectionProfiles/profiles_settings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<component name="InspectionProjectProfileManager">
-  <settings>
-    <option name="USE_PROJECT_PROFILE" value="false" />
-    <version value="1.0" />
-  </settings>
-</component>
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index e5318c2..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (ergpy)" project-jdk-type="Python SDK" />
-</project>
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index a5a7861..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="ProjectModuleManager">
-    <modules>
-      <module fileurl="file://$PROJECT_DIR$/.idea/ergpy.iml" filepath="$PROJECT_DIR$/.idea/ergpy.iml" />
-    </modules>
-  </component>
-</project>
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 94a25f7..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="VcsDirectoryMappings">
-    <mapping directory="$PROJECT_DIR$" vcs="Git" />
-  </component>
-</project>
\ No newline at end of file


Test patch:
diff --git a/tests/integration/test_helper_functions.py b/tests/integration/test_helper_functions.py
new file mode 100644
index 0000000..a5366ed
--- /dev/null
+++ b/tests/integration/test_helper_functions.py
@@ -0,0 +1,44 @@
+"""
+Testing `erpy.helper_functions`
+===============================
+
+Handled functions :
+- get_wallet_address
+
+"""
+# Necessary packages
+from ergpy import helper_functions
+from ergpy.appkit import ErgoAppKit
+import json
+import logging
+import os
+import sys
+
+# Setup
+logger: logging.Logger = logging.getLogger()
+logger.setLevel(logging.INFO)
+
+# Tested functions
+def test_get_wallet_address():
+    # Expected
+    expected: str = "3WykkLPB7PdS2MA7uTTWNSoCaYiZsSLPtS7ZuH9TUjRgiL75ygfa"
+
+    # Arguments
+    node_url: str = "http://213.239.193.208:9052/"
+    ergo: ErgoAppKit = ErgoAppKit(node_url=node_url)
+    amount: int = 1
+    wallet_mnemonic: str = "what stadium typical spell rate truly pen tongue fuel intact fluid strike vibrant city shine"
+
+    # Call function
+    logging.info('BEGIN get_wallet_address')
+    actual: str = json.loads(helper_functions.get_wallet_address(ergo=ergo, amount=amount, wallet_mnemonic=wallet_mnemonic))[0]
+    logging.info('END get_wallet_address')
+
+    assert actual == expected
+
+# Program entrypoint
+if __name__ == '__main__':
+    test_get_wallet_address()
+
+    # Gracefully exit
+    sys.exit(os.EX_OK)
diff --git a/tests/package/package.sh b/tests/package/package.sh
new file mode 100644
index 0000000..76cbb34
--- /dev/null
+++ b/tests/package/package.sh
@@ -0,0 +1,5 @@
+# Install local project
+python -m pip install -e .
+
+# Check package presence
+python -m pip freeze | grep ergpy
diff --git a/tests/quality/lint.sh b/tests/quality/lint.sh
new file mode 100644
index 0000000..e83ba94
--- /dev/null
+++ b/tests/quality/lint.sh
@@ -0,0 +1,1 @@
+echo "pylint..."
\ No newline at end of file