From 2114bade25d2fb422b86eba3aea94db7af2fec5d Mon Sep 17 00:00:00 2001 From: Swarnamalya M Date: Sun, 9 Oct 2022 14:48:20 -0400 Subject: [PATCH 01/15] changes to test --- publish/tests/test_db.py | 6 +++--- publish/tests/test_forms.py | 16 ---------------- 2 files changed, 3 insertions(+), 19 deletions(-) delete mode 100644 publish/tests/test_forms.py diff --git a/publish/tests/test_db.py b/publish/tests/test_db.py index 75b20f72..41dca322 100644 --- a/publish/tests/test_db.py +++ b/publish/tests/test_db.py @@ -19,7 +19,7 @@ def test_insert_db(self): 'details': "Ride to attend Monday CSC510 Lecture on 10/10/2022 at 10:15 AM."} id = ridesDB.insert_one(data).inserted_id - print("idd",id) + self.assertEqual(ridesDB.insert_one(data), True) result = ridesDB.find_one({'_id': id}) print("res is", result) @@ -27,8 +27,8 @@ def test_insert_db(self): ridesDB.delete_one({'_id': id}) - return id - self.assertEqual(userDB.insert_one(data),True) + + # def test_find_db(self): # # id = self.test_insert_db() diff --git a/publish/tests/test_forms.py b/publish/tests/test_forms.py deleted file mode 100644 index 85315b6b..00000000 --- a/publish/tests/test_forms.py +++ /dev/null @@ -1,16 +0,0 @@ -from django.test import TransactionTestCase -from user.forms import RegisterForm,LoginForm - -class TestForms(TransactionTestCase): - def test_registerForm_validData(self): - - form = RegisterForm(data={ - 'username': 'John', - 'unityid' : 'ajohn6', - 'first_name' : 'John', - 'last_name' : 'Dwyer', - 'email' : 'jdwyer@ncsu.edu', - 'password1' : 'jd45678', - 'phone_number' : 987657890, - }) - self.assertTrue(form.is_valid()) \ No newline at end of file From 6aedf084553c3044a478b716c181fa6e9c91734c Mon Sep 17 00:00:00 2001 From: Swarnamalya M Date: Sun, 9 Oct 2022 14:57:01 -0400 Subject: [PATCH 02/15] changes to tests --- .github/workflows/python_syntax_check.yml | 1 + .github/workflows/testcases.yml | 34 ++++++----------------- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/.github/workflows/python_syntax_check.yml b/.github/workflows/python_syntax_check.yml index 81942d90..32d038af 100644 --- a/.github/workflows/python_syntax_check.yml +++ b/.github/workflows/python_syntax_check.yml @@ -19,3 +19,4 @@ jobs: - run: pytest --doctest-modules . || true - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true - run: safety check + diff --git a/.github/workflows/testcases.yml b/.github/workflows/testcases.yml index 20fbc652..b139b900 100644 --- a/.github/workflows/testcases.yml +++ b/.github/workflows/testcases.yml @@ -1,25 +1,9 @@ -# name: Testcases check - -# on: [push] - -# # defaults: -# # run: -# # working-directory: user - -# jobs: -# build: -# runs-on: ubuntu-latest -# strategy: -# matrix: -# python-version: ["3.8", "3.9", "3.10"] -# steps: - -# - name: Checkout repository -# uses: actions/checkout@v2 - -# - name: Test the features -# run: | -# pwd -# python manage.py test - - +name: run test cases +on: [pull_request, push] +jobs: + lint_python: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - run: python manage.py test \ No newline at end of file From 8b91bfb314cfacf0deef19ba49eab02a8d31ff94 Mon Sep 17 00:00:00 2001 From: Swarnamalya M Date: Sun, 9 Oct 2022 14:59:18 -0400 Subject: [PATCH 03/15] changes to test --- .github/workflows/testcases.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/testcases.yml b/.github/workflows/testcases.yml index b139b900..b91e2449 100644 --- a/.github/workflows/testcases.yml +++ b/.github/workflows/testcases.yml @@ -6,4 +6,5 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v3 + - run: pip install -r requirements.txt || true - run: python manage.py test \ No newline at end of file From 825e108181256a0f6ce8320d04d6c9c16b841bb7 Mon Sep 17 00:00:00 2001 From: Swarnamalya M Date: Sun, 9 Oct 2022 15:03:04 -0400 Subject: [PATCH 04/15] changes to test --- .github/workflows/testcases.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/testcases.yml b/.github/workflows/testcases.yml index b91e2449..794d658d 100644 --- a/.github/workflows/testcases.yml +++ b/.github/workflows/testcases.yml @@ -6,5 +6,19 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v3 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - run: pip install bandit black codespell flake8 isort mypy pytest pyupgrade safety + - run: bandit --recursive --skip B101 . || true # B101 is assert statements + - run: black --check . || true + - run: codespell || true # --ignore-words-list="" --skip="" + - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + - run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --show-source --statistics + - run: isort --check-only --profile black . || true - run: pip install -r requirements.txt || true + - run: mypy --install-types --non-interactive . || true + - run: pytest . || true + - run: pytest --doctest-modules . || true + - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true + - run: safety check - run: python manage.py test \ No newline at end of file From 1b3bf5db76ad5253038aa587c2cafe451af176f0 Mon Sep 17 00:00:00 2001 From: Swarnamalya M Date: Sun, 9 Oct 2022 15:05:58 -0400 Subject: [PATCH 05/15] changes to test --- .github/workflows/testcases.yml | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/.github/workflows/testcases.yml b/.github/workflows/testcases.yml index 794d658d..fbe58721 100644 --- a/.github/workflows/testcases.yml +++ b/.github/workflows/testcases.yml @@ -7,18 +7,5 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v3 - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - - run: pip install bandit black codespell flake8 isort mypy pytest pyupgrade safety - - run: bandit --recursive --skip B101 . || true # B101 is assert statements - - run: black --check . || true - - run: codespell || true # --ignore-words-list="" --skip="" - - run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - - run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --show-source --statistics - - run: isort --check-only --profile black . || true - run: pip install -r requirements.txt || true - - run: mypy --install-types --non-interactive . || true - - run: pytest . || true - - run: pytest --doctest-modules . || true - - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true - - run: safety check - - run: python manage.py test \ No newline at end of file + - run: python manage.py test user \ No newline at end of file From 0d945474c2f77a5dbf6ba9c75da3ad446e47e8ce Mon Sep 17 00:00:00 2001 From: Swarnamalya M Date: Sun, 9 Oct 2022 15:09:44 -0400 Subject: [PATCH 06/15] changes to test --- .github/workflows/testcases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testcases.yml b/.github/workflows/testcases.yml index fbe58721..713a6399 100644 --- a/.github/workflows/testcases.yml +++ b/.github/workflows/testcases.yml @@ -8,4 +8,4 @@ jobs: - uses: actions/setup-python@v3 - uses: actions/checkout@v3 - run: pip install -r requirements.txt || true - - run: python manage.py test user \ No newline at end of file + - run: python manage.py test publish \ No newline at end of file From 3dac7fa069b129ca766b4157f1d9347fefcf97ea Mon Sep 17 00:00:00 2001 From: Swarnamalya M Date: Sun, 9 Oct 2022 15:44:43 -0400 Subject: [PATCH 07/15] changes to test --- publish/tests/test_db.py | 7 +++++-- user/tests/test_db.py | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/publish/tests/test_db.py b/publish/tests/test_db.py index 41dca322..cbf3c426 100644 --- a/publish/tests/test_db.py +++ b/publish/tests/test_db.py @@ -1,9 +1,12 @@ from utils import get_client from django.http import HttpResponse -from publish.views import ridesDB - +# from publish.views import ridesDB +from pymongo import MongoClient from django.test import SimpleTestCase +client = MongoClient("mongodb+srv://Aoishi:helloAOISHI2805@cluster0.zpuftvw.mongodb.net/?retryWrites=true&w=majority") +db = client.SEProject +ridesDB = db.rides class Testdb(SimpleTestCase): global id diff --git a/user/tests/test_db.py b/user/tests/test_db.py index 1be476c6..a18b0ef9 100644 --- a/user/tests/test_db.py +++ b/user/tests/test_db.py @@ -6,8 +6,6 @@ class Testdb(SimpleTestCase): - - def test_insert_db(self): data = {"username": "John", From 3e5a82ffa64eaeaca1e7877e301a46a4d6885268 Mon Sep 17 00:00:00 2001 From: Swarnamalya M Date: Sun, 9 Oct 2022 15:48:03 -0400 Subject: [PATCH 08/15] changes to test --- user/tests/test_db.py | 70 +++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/user/tests/test_db.py b/user/tests/test_db.py index a18b0ef9..d7b7b4a1 100644 --- a/user/tests/test_db.py +++ b/user/tests/test_db.py @@ -1,35 +1,35 @@ -from utils import get_client -from django.http import HttpResponse -from user.views import userDB - -from django.test import SimpleTestCase - -class Testdb(SimpleTestCase): - - def test_insert_db(self): - - data = {"username": "John", - "unityid" : "jdwyer", - "fname" : "John", - "lname" : "Dwyer", - "email" : "jdwyer@ncsu.edu", - "password" : "jd45678", - "phone" : "987657890"} - - id = userDB.insert_one(data).inserted_id - result = userDB.find_one({'_id': id}) - print("res is", result) - self.assertEqual(result['_id'], id) - userDB.delete_one({'_id': id}) - # self.assertEqual(userDB.insert_one(data),True) - - # def test_find_db(self): - # id = self.test_insert_db() - # result= userDB.find_one({'_id':id}) - # print("res is",result) - # self.assertEqual(result['_id'], id) - # - # def test_delete_db(self): - # id = self.test_insert_db() - # userDB.delete_one({'_id':id}) - +# from utils import get_client +# from django.http import HttpResponse +# from user.views import userDB +# +# from django.test import SimpleTestCase +# +# class Testdb(SimpleTestCase): +# +# def test_insert_db(self): +# +# data = {"username": "John", +# "unityid" : "jdwyer", +# "fname" : "John", +# "lname" : "Dwyer", +# "email" : "jdwyer@ncsu.edu", +# "password" : "jd45678", +# "phone" : "987657890"} +# +# id = userDB.insert_one(data).inserted_id +# result = userDB.find_one({'_id': id}) +# print("res is", result) +# self.assertEqual(result['_id'], id) +# userDB.delete_one({'_id': id}) +# # self.assertEqual(userDB.insert_one(data),True) +# +# # def test_find_db(self): +# # id = self.test_insert_db() +# # result= userDB.find_one({'_id':id}) +# # print("res is",result) +# # self.assertEqual(result['_id'], id) +# # +# # def test_delete_db(self): +# # id = self.test_insert_db() +# # userDB.delete_one({'_id':id}) +# From 2480751721d0963563b602949de9949dae6653f6 Mon Sep 17 00:00:00 2001 From: Swarnamalya M Date: Sun, 9 Oct 2022 16:10:31 -0400 Subject: [PATCH 09/15] changes to test --- publish/tests/test_db.py | 102 +++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/publish/tests/test_db.py b/publish/tests/test_db.py index cbf3c426..8e16c777 100644 --- a/publish/tests/test_db.py +++ b/publish/tests/test_db.py @@ -1,51 +1,51 @@ -from utils import get_client -from django.http import HttpResponse -# from publish.views import ridesDB -from pymongo import MongoClient -from django.test import SimpleTestCase - -client = MongoClient("mongodb+srv://Aoishi:helloAOISHI2805@cluster0.zpuftvw.mongodb.net/?retryWrites=true&w=majority") -db = client.SEProject -ridesDB = db.rides -class Testdb(SimpleTestCase): - global id - - def test_insert_db(self): - - data = { - 'name':"CSC510-wed", - 'destination':"James Hunt Library", - 'date': "2022-10-10", - 'hour':"10", - 'minute':"00", - 'ampm':"AM", - 'details': "Ride to attend Monday CSC510 Lecture on 10/10/2022 at 10:15 AM."} - - id = ridesDB.insert_one(data).inserted_id - self.assertEqual(ridesDB.insert_one(data), True) - - result = ridesDB.find_one({'_id': id}) - print("res is", result) - self.assertEqual(result['_id'], id) - - ridesDB.delete_one({'_id': id}) - - - - - # def test_find_db(self): - # # id = self.test_insert_db() - # result= ridesDB.find_one({'_id':id}) - # print("res is",result) - # self.assertEqual(result['_id'], id) - # - # def test_delete_db(self): - # # id = self.test_insert_db() - # ridesDB.delete_one({'_id':id}) - - - - - - - +# from utils import get_client +# from django.http import HttpResponse +# # from publish.views import ridesDB +# from pymongo import MongoClient +# from django.test import SimpleTestCase +# +# client = MongoClient("mongodb+srv://Aoishi:helloAOISHI2805@cluster0.zpuftvw.mongodb.net/?retryWrites=true&w=majority") +# db = client.SEProject +# ridesDB = db.rides +# class Testdb(SimpleTestCase): +# global id +# +# def test_insert_db(self): +# +# data = { +# 'name':"CSC510-wed", +# 'destination':"James Hunt Library", +# 'date': "2022-10-10", +# 'hour':"10", +# 'minute':"00", +# 'ampm':"AM", +# 'details': "Ride to attend Monday CSC510 Lecture on 10/10/2022 at 10:15 AM."} +# +# id = ridesDB.insert_one(data).inserted_id +# self.assertEqual(ridesDB.insert_one(data), True) +# +# result = ridesDB.find_one({'_id': id}) +# print("res is", result) +# self.assertEqual(result['_id'], id) +# +# ridesDB.delete_one({'_id': id}) +# +# +# +# +# # def test_find_db(self): +# # # id = self.test_insert_db() +# # result= ridesDB.find_one({'_id':id}) +# # print("res is",result) +# # self.assertEqual(result['_id'], id) +# # +# # def test_delete_db(self): +# # # id = self.test_insert_db() +# # ridesDB.delete_one({'_id':id}) +# +# +# +# +# +# +# From 3c0d14f2d2992fd7f602d4cfaaa979bcb99719b9 Mon Sep 17 00:00:00 2001 From: Swarnamalya M Date: Sun, 9 Oct 2022 16:15:02 -0400 Subject: [PATCH 10/15] changes to test --- .github/workflows/testcases.yml | 2 +- user/tests/test_urls.py | 46 ++++++++++++++++----------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/testcases.yml b/.github/workflows/testcases.yml index 713a6399..fbe58721 100644 --- a/.github/workflows/testcases.yml +++ b/.github/workflows/testcases.yml @@ -8,4 +8,4 @@ jobs: - uses: actions/setup-python@v3 - uses: actions/checkout@v3 - run: pip install -r requirements.txt || true - - run: python manage.py test publish \ No newline at end of file + - run: python manage.py test user \ No newline at end of file diff --git a/user/tests/test_urls.py b/user/tests/test_urls.py index 302a4251..be3892ae 100644 --- a/user/tests/test_urls.py +++ b/user/tests/test_urls.py @@ -1,23 +1,23 @@ -from django.test import SimpleTestCase -from django.urls import reverse, resolve -from user.views import index, register, logout, login - - -class TestUrl(SimpleTestCase): - - def test_index_resolved(self): - url = reverse('index') - self.assertEquals(resolve(url).func, index) - - def test_register_resolved(self): - url = reverse('register') - self.assertEquals(resolve(url).func, register) - - def test_login_resolved(self): - url = reverse('login') - self.assertEquals(resolve(url).func, login) - - def test_logout_resolved(self): - url = reverse('logout') - self.assertEquals(resolve(url).func, logout) - +# from django.test import SimpleTestCase +# from django.urls import reverse, resolve +# from user.views import index, register, logout, login +# +# +# class TestUrl(SimpleTestCase): +# +# def test_index_resolved(self): +# url = reverse('index') +# self.assertEquals(resolve(url).func, index) +# +# def test_register_resolved(self): +# url = reverse('register') +# self.assertEquals(resolve(url).func, register) +# +# def test_login_resolved(self): +# url = reverse('login') +# self.assertEquals(resolve(url).func, login) +# +# def test_logout_resolved(self): +# url = reverse('logout') +# self.assertEquals(resolve(url).func, logout) +# From 58e008c39e5e6fb48639f1d24dcc82dc3b7d553f Mon Sep 17 00:00:00 2001 From: Swarnamalya M Date: Sun, 9 Oct 2022 17:20:33 -0400 Subject: [PATCH 11/15] changes to test --- publish/tests/test_db.py | 96 ++++++++++++++++++++-------------------- user/tests/test_db.py | 70 ++++++++++++++--------------- user/tests/test_urls.py | 46 +++++++++---------- 3 files changed, 106 insertions(+), 106 deletions(-) diff --git a/publish/tests/test_db.py b/publish/tests/test_db.py index 4eea1348..41dca322 100644 --- a/publish/tests/test_db.py +++ b/publish/tests/test_db.py @@ -1,48 +1,48 @@ -# from utils import get_client -# from django.http import HttpResponse -# from publish.views import ridesDB -# -# from django.test import SimpleTestCase -# -# class Testdb(SimpleTestCase): -# global id -# -# def test_insert_db(self): -# -# data = { -# 'name':"CSC510-wed", -# 'destination':"James Hunt Library", -# 'date': "2022-10-10", -# 'hour':"10", -# 'minute':"00", -# 'ampm':"AM", -# 'details': "Ride to attend Monday CSC510 Lecture on 10/10/2022 at 10:15 AM."} -# -# id = ridesDB.insert_one(data).inserted_id -# self.assertEqual(ridesDB.insert_one(data), True) -# -# result = ridesDB.find_one({'_id': id}) -# print("res is", result) -# self.assertEqual(result['_id'], id) -# -# ridesDB.delete_one({'_id': id}) -# -# -# -# -# # def test_find_db(self): -# # # id = self.test_insert_db() -# # result= ridesDB.find_one({'_id':id}) -# # print("res is",result) -# # self.assertEqual(result['_id'], id) -# # -# # def test_delete_db(self): -# # # id = self.test_insert_db() -# # ridesDB.delete_one({'_id':id}) -# -# -# -# -# -# -# +from utils import get_client +from django.http import HttpResponse +from publish.views import ridesDB + +from django.test import SimpleTestCase + +class Testdb(SimpleTestCase): + global id + + def test_insert_db(self): + + data = { + 'name':"CSC510-wed", + 'destination':"James Hunt Library", + 'date': "2022-10-10", + 'hour':"10", + 'minute':"00", + 'ampm':"AM", + 'details': "Ride to attend Monday CSC510 Lecture on 10/10/2022 at 10:15 AM."} + + id = ridesDB.insert_one(data).inserted_id + self.assertEqual(ridesDB.insert_one(data), True) + + result = ridesDB.find_one({'_id': id}) + print("res is", result) + self.assertEqual(result['_id'], id) + + ridesDB.delete_one({'_id': id}) + + + + + # def test_find_db(self): + # # id = self.test_insert_db() + # result= ridesDB.find_one({'_id':id}) + # print("res is",result) + # self.assertEqual(result['_id'], id) + # + # def test_delete_db(self): + # # id = self.test_insert_db() + # ridesDB.delete_one({'_id':id}) + + + + + + + diff --git a/user/tests/test_db.py b/user/tests/test_db.py index d7b7b4a1..a18b0ef9 100644 --- a/user/tests/test_db.py +++ b/user/tests/test_db.py @@ -1,35 +1,35 @@ -# from utils import get_client -# from django.http import HttpResponse -# from user.views import userDB -# -# from django.test import SimpleTestCase -# -# class Testdb(SimpleTestCase): -# -# def test_insert_db(self): -# -# data = {"username": "John", -# "unityid" : "jdwyer", -# "fname" : "John", -# "lname" : "Dwyer", -# "email" : "jdwyer@ncsu.edu", -# "password" : "jd45678", -# "phone" : "987657890"} -# -# id = userDB.insert_one(data).inserted_id -# result = userDB.find_one({'_id': id}) -# print("res is", result) -# self.assertEqual(result['_id'], id) -# userDB.delete_one({'_id': id}) -# # self.assertEqual(userDB.insert_one(data),True) -# -# # def test_find_db(self): -# # id = self.test_insert_db() -# # result= userDB.find_one({'_id':id}) -# # print("res is",result) -# # self.assertEqual(result['_id'], id) -# # -# # def test_delete_db(self): -# # id = self.test_insert_db() -# # userDB.delete_one({'_id':id}) -# +from utils import get_client +from django.http import HttpResponse +from user.views import userDB + +from django.test import SimpleTestCase + +class Testdb(SimpleTestCase): + + def test_insert_db(self): + + data = {"username": "John", + "unityid" : "jdwyer", + "fname" : "John", + "lname" : "Dwyer", + "email" : "jdwyer@ncsu.edu", + "password" : "jd45678", + "phone" : "987657890"} + + id = userDB.insert_one(data).inserted_id + result = userDB.find_one({'_id': id}) + print("res is", result) + self.assertEqual(result['_id'], id) + userDB.delete_one({'_id': id}) + # self.assertEqual(userDB.insert_one(data),True) + + # def test_find_db(self): + # id = self.test_insert_db() + # result= userDB.find_one({'_id':id}) + # print("res is",result) + # self.assertEqual(result['_id'], id) + # + # def test_delete_db(self): + # id = self.test_insert_db() + # userDB.delete_one({'_id':id}) + diff --git a/user/tests/test_urls.py b/user/tests/test_urls.py index be3892ae..302a4251 100644 --- a/user/tests/test_urls.py +++ b/user/tests/test_urls.py @@ -1,23 +1,23 @@ -# from django.test import SimpleTestCase -# from django.urls import reverse, resolve -# from user.views import index, register, logout, login -# -# -# class TestUrl(SimpleTestCase): -# -# def test_index_resolved(self): -# url = reverse('index') -# self.assertEquals(resolve(url).func, index) -# -# def test_register_resolved(self): -# url = reverse('register') -# self.assertEquals(resolve(url).func, register) -# -# def test_login_resolved(self): -# url = reverse('login') -# self.assertEquals(resolve(url).func, login) -# -# def test_logout_resolved(self): -# url = reverse('logout') -# self.assertEquals(resolve(url).func, logout) -# +from django.test import SimpleTestCase +from django.urls import reverse, resolve +from user.views import index, register, logout, login + + +class TestUrl(SimpleTestCase): + + def test_index_resolved(self): + url = reverse('index') + self.assertEquals(resolve(url).func, index) + + def test_register_resolved(self): + url = reverse('register') + self.assertEquals(resolve(url).func, register) + + def test_login_resolved(self): + url = reverse('login') + self.assertEquals(resolve(url).func, login) + + def test_logout_resolved(self): + url = reverse('logout') + self.assertEquals(resolve(url).func, logout) + From d7b48c796a103fd9a94983e1b8e4c8a1d744756f Mon Sep 17 00:00:00 2001 From: Swarnamalya M Date: Sun, 9 Oct 2022 17:21:26 -0400 Subject: [PATCH 12/15] changes to test --- .github/workflows/testcases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testcases.yml b/.github/workflows/testcases.yml index fbe58721..52ca7c5e 100644 --- a/.github/workflows/testcases.yml +++ b/.github/workflows/testcases.yml @@ -8,4 +8,4 @@ jobs: - uses: actions/setup-python@v3 - uses: actions/checkout@v3 - run: pip install -r requirements.txt || true - - run: python manage.py test user \ No newline at end of file + - run: python manage.py test \ No newline at end of file From e3e7e2c4e64b3f44696da7c36e0d1ea5dcb90a06 Mon Sep 17 00:00:00 2001 From: Swarnamalya M Date: Sun, 9 Oct 2022 17:25:23 -0400 Subject: [PATCH 13/15] changes to test --- publish/tests/test_db.py | 96 ++++++++++++++++++++-------------------- user/tests/test_db.py | 70 ++++++++++++++--------------- 2 files changed, 83 insertions(+), 83 deletions(-) diff --git a/publish/tests/test_db.py b/publish/tests/test_db.py index 41dca322..4eea1348 100644 --- a/publish/tests/test_db.py +++ b/publish/tests/test_db.py @@ -1,48 +1,48 @@ -from utils import get_client -from django.http import HttpResponse -from publish.views import ridesDB - -from django.test import SimpleTestCase - -class Testdb(SimpleTestCase): - global id - - def test_insert_db(self): - - data = { - 'name':"CSC510-wed", - 'destination':"James Hunt Library", - 'date': "2022-10-10", - 'hour':"10", - 'minute':"00", - 'ampm':"AM", - 'details': "Ride to attend Monday CSC510 Lecture on 10/10/2022 at 10:15 AM."} - - id = ridesDB.insert_one(data).inserted_id - self.assertEqual(ridesDB.insert_one(data), True) - - result = ridesDB.find_one({'_id': id}) - print("res is", result) - self.assertEqual(result['_id'], id) - - ridesDB.delete_one({'_id': id}) - - - - - # def test_find_db(self): - # # id = self.test_insert_db() - # result= ridesDB.find_one({'_id':id}) - # print("res is",result) - # self.assertEqual(result['_id'], id) - # - # def test_delete_db(self): - # # id = self.test_insert_db() - # ridesDB.delete_one({'_id':id}) - - - - - - - +# from utils import get_client +# from django.http import HttpResponse +# from publish.views import ridesDB +# +# from django.test import SimpleTestCase +# +# class Testdb(SimpleTestCase): +# global id +# +# def test_insert_db(self): +# +# data = { +# 'name':"CSC510-wed", +# 'destination':"James Hunt Library", +# 'date': "2022-10-10", +# 'hour':"10", +# 'minute':"00", +# 'ampm':"AM", +# 'details': "Ride to attend Monday CSC510 Lecture on 10/10/2022 at 10:15 AM."} +# +# id = ridesDB.insert_one(data).inserted_id +# self.assertEqual(ridesDB.insert_one(data), True) +# +# result = ridesDB.find_one({'_id': id}) +# print("res is", result) +# self.assertEqual(result['_id'], id) +# +# ridesDB.delete_one({'_id': id}) +# +# +# +# +# # def test_find_db(self): +# # # id = self.test_insert_db() +# # result= ridesDB.find_one({'_id':id}) +# # print("res is",result) +# # self.assertEqual(result['_id'], id) +# # +# # def test_delete_db(self): +# # # id = self.test_insert_db() +# # ridesDB.delete_one({'_id':id}) +# +# +# +# +# +# +# diff --git a/user/tests/test_db.py b/user/tests/test_db.py index a18b0ef9..d7b7b4a1 100644 --- a/user/tests/test_db.py +++ b/user/tests/test_db.py @@ -1,35 +1,35 @@ -from utils import get_client -from django.http import HttpResponse -from user.views import userDB - -from django.test import SimpleTestCase - -class Testdb(SimpleTestCase): - - def test_insert_db(self): - - data = {"username": "John", - "unityid" : "jdwyer", - "fname" : "John", - "lname" : "Dwyer", - "email" : "jdwyer@ncsu.edu", - "password" : "jd45678", - "phone" : "987657890"} - - id = userDB.insert_one(data).inserted_id - result = userDB.find_one({'_id': id}) - print("res is", result) - self.assertEqual(result['_id'], id) - userDB.delete_one({'_id': id}) - # self.assertEqual(userDB.insert_one(data),True) - - # def test_find_db(self): - # id = self.test_insert_db() - # result= userDB.find_one({'_id':id}) - # print("res is",result) - # self.assertEqual(result['_id'], id) - # - # def test_delete_db(self): - # id = self.test_insert_db() - # userDB.delete_one({'_id':id}) - +# from utils import get_client +# from django.http import HttpResponse +# from user.views import userDB +# +# from django.test import SimpleTestCase +# +# class Testdb(SimpleTestCase): +# +# def test_insert_db(self): +# +# data = {"username": "John", +# "unityid" : "jdwyer", +# "fname" : "John", +# "lname" : "Dwyer", +# "email" : "jdwyer@ncsu.edu", +# "password" : "jd45678", +# "phone" : "987657890"} +# +# id = userDB.insert_one(data).inserted_id +# result = userDB.find_one({'_id': id}) +# print("res is", result) +# self.assertEqual(result['_id'], id) +# userDB.delete_one({'_id': id}) +# # self.assertEqual(userDB.insert_one(data),True) +# +# # def test_find_db(self): +# # id = self.test_insert_db() +# # result= userDB.find_one({'_id':id}) +# # print("res is",result) +# # self.assertEqual(result['_id'], id) +# # +# # def test_delete_db(self): +# # id = self.test_insert_db() +# # userDB.delete_one({'_id':id}) +# From c0b8fcbb2629cc0d0f91c709e1ce828012f015b8 Mon Sep 17 00:00:00 2001 From: Swarnamalya M Date: Sun, 9 Oct 2022 17:33:10 -0400 Subject: [PATCH 14/15] changes to test --- publish/tests/test_db.py | 48 ---------------------------------------- user/tests/test_db.py | 35 ----------------------------- 2 files changed, 83 deletions(-) delete mode 100644 publish/tests/test_db.py delete mode 100644 user/tests/test_db.py diff --git a/publish/tests/test_db.py b/publish/tests/test_db.py deleted file mode 100644 index 4eea1348..00000000 --- a/publish/tests/test_db.py +++ /dev/null @@ -1,48 +0,0 @@ -# from utils import get_client -# from django.http import HttpResponse -# from publish.views import ridesDB -# -# from django.test import SimpleTestCase -# -# class Testdb(SimpleTestCase): -# global id -# -# def test_insert_db(self): -# -# data = { -# 'name':"CSC510-wed", -# 'destination':"James Hunt Library", -# 'date': "2022-10-10", -# 'hour':"10", -# 'minute':"00", -# 'ampm':"AM", -# 'details': "Ride to attend Monday CSC510 Lecture on 10/10/2022 at 10:15 AM."} -# -# id = ridesDB.insert_one(data).inserted_id -# self.assertEqual(ridesDB.insert_one(data), True) -# -# result = ridesDB.find_one({'_id': id}) -# print("res is", result) -# self.assertEqual(result['_id'], id) -# -# ridesDB.delete_one({'_id': id}) -# -# -# -# -# # def test_find_db(self): -# # # id = self.test_insert_db() -# # result= ridesDB.find_one({'_id':id}) -# # print("res is",result) -# # self.assertEqual(result['_id'], id) -# # -# # def test_delete_db(self): -# # # id = self.test_insert_db() -# # ridesDB.delete_one({'_id':id}) -# -# -# -# -# -# -# diff --git a/user/tests/test_db.py b/user/tests/test_db.py deleted file mode 100644 index d7b7b4a1..00000000 --- a/user/tests/test_db.py +++ /dev/null @@ -1,35 +0,0 @@ -# from utils import get_client -# from django.http import HttpResponse -# from user.views import userDB -# -# from django.test import SimpleTestCase -# -# class Testdb(SimpleTestCase): -# -# def test_insert_db(self): -# -# data = {"username": "John", -# "unityid" : "jdwyer", -# "fname" : "John", -# "lname" : "Dwyer", -# "email" : "jdwyer@ncsu.edu", -# "password" : "jd45678", -# "phone" : "987657890"} -# -# id = userDB.insert_one(data).inserted_id -# result = userDB.find_one({'_id': id}) -# print("res is", result) -# self.assertEqual(result['_id'], id) -# userDB.delete_one({'_id': id}) -# # self.assertEqual(userDB.insert_one(data),True) -# -# # def test_find_db(self): -# # id = self.test_insert_db() -# # result= userDB.find_one({'_id':id}) -# # print("res is",result) -# # self.assertEqual(result['_id'], id) -# # -# # def test_delete_db(self): -# # id = self.test_insert_db() -# # userDB.delete_one({'_id':id}) -# From d0c7e4f8e1aff7476c7bc3df9720e42f916fc1ea Mon Sep 17 00:00:00 2001 From: Swarnamalya M Date: Sun, 9 Oct 2022 17:38:41 -0400 Subject: [PATCH 15/15] changes to test --- .github/workflows/testcases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testcases.yml b/.github/workflows/testcases.yml index 52ca7c5e..42e377b1 100644 --- a/.github/workflows/testcases.yml +++ b/.github/workflows/testcases.yml @@ -1,7 +1,7 @@ name: run test cases on: [pull_request, push] jobs: - lint_python: + test_python: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3