Skip to content

Commit

Permalink
Merge branch 'neha-1' of https://github.com/utsavll0/calorieApp_server
Browse files Browse the repository at this point in the history
…into neha-1
  • Loading branch information
neha7799 committed Oct 20, 2023
2 parents d959f8f + 8a3b9a7 commit 4f32300
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 59 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/code_cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,19 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Python 3.9.8
- name: Install Python 3.10.13
uses: actions/setup-python@v1
with:
python-version: 3.9.9
python-version: 3.10.13
- name: Install dependencies
run: |
pip install pytest-cov
pip install pytest-cov pytest
pip install -r requirements.txt
echo requirements installed
- name: Run the tests
run: |
python application.py &
sleep 5
cd tests
coverage run test_module.py
pytest tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,18 @@ This is the page where the user can see their history in the form of a bar graph
4. Bug Fixes


# Team Members
# Contributers

<center>
<table>
<tr>
<td align="center"><a href="https://github.com/utsavll0"><img src="https://avatars.githubusercontent.com/utsavll0" width="100px;" alt=""/><br /><sub><b>Utsavkumar Lal</b></sub></a><br /></td>
<td align="center"><a href="https://github.com/neha7799"><img src="https://avatars.githubusercontent.com/neha7799" width="100px;" alt=""/><br /><sub><b>Neha Patil</b></sub></a></td>
<td align="center"><a href="https://github.com/ojas1901"><img src="https://avatars.githubusercontent.com/ojas1901" width="100px;" alt=""/><br /><sub><b>Ojas Kulkarni</b></sub></a><br /></td>
<td align="center"><a href="https://github.com/Viggy12126"><img src="https://avatars.githubusercontent.com/Viggy12126" width="100px;" alt=""/><br /><sub><b>Vighnesh Hegde</b></sub></a><br /></td>
</tr>
<tr>
<tr><td></td></tr>
<td align="center"><a href="https://github.com/deekay2310"><img src="https://avatars.githubusercontent.com/u/29257773?v=4" width="100px;" alt=""/><br /><sub><b>Dev Kumar</b></sub></a><br /></td>
<td align="center"><a href="https://github.com/PrakruthiSomashekar"><img src="https://avatars.githubusercontent.com/u/62984587?v=4" width="100px;" alt=""/><br /><sub><b>Prakruthi Somashekar</b></sub></a></td>
<td align="center"><a href="https://github.com/radhikaraman20"><img src="https://avatars.githubusercontent.com/u/89432698?s=400&v=4" width="100px;" alt=""/><br /><sub><b>Radhika Raman</b></sub></a><br /></td>
Expand Down
7 changes: 2 additions & 5 deletions model/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import numpy as np
import string

df = pd.read_csv(
'C:\\Users\\Shivam\\Desktop\\calorieApp_server\\model\\cleaned_data.csv')
df = pd.read_csv('model/cleaned_data.csv')
index_list = df.index.tolist()

client = pymongo.MongoClient('mongodb://localhost:27017')
Expand Down Expand Up @@ -146,9 +145,7 @@ def find_subset(weight: list, req_sum: int):
print('Consume one of these items', u_cal_food[i],'*',list_occ[i][1], 'times')
'''

diet_report = open(
'C:\\Users\\Shivam\\Desktop\\calorieApp_server\\model\\diet_guide.txt',
"wt") #path
diet_report = open('model/diet_guide.txt', "wt") #path

for i in range(len(u_cal)):
fl = 'Consume one of these items', u_cal_food[i], '*', list_occ[i][
Expand Down
4 changes: 2 additions & 2 deletions tests/test_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ class TestHistoryService(unittest.TestCase):
def test_total_calories_to_burn_a(self):
tw = 90
cw = 100
self.assertEquals(history.total_calories_to_burn(tw, cw), -77000)
self.assertEqual(history.total_calories_to_burn(tw, cw), -77000)

def test_total_calories_to_burn_b(self):
tw = 100
cw = 90
self.assertEquals(history.total_calories_to_burn(tw, cw), 77000)
self.assertEqual(history.total_calories_to_burn(tw, cw), 77000)

def test_calories_to_burn_a(self):
target_calories = -77000
Expand Down
78 changes: 35 additions & 43 deletions tests/test_module.py
Original file line number Diff line number Diff line change
@@ -1,55 +1,47 @@
import unittest
# from application import app


class BasicTestCase(unittest.TestCase):

def test_logout(self):
pass

# self.app = app.test_client()
# ans =self.app.get('/logout')
# self.assertEqual(ans.status_code, 200)

# def test_home(self):
# self.app = app.test_client()
# ans =self.app.get('/home')
# self.assertEqual(ans.status_code, 302)

# def test_login(self):
# self.app = app.test_client()
# ans =self.app.get('/login')
# self.assertEqual(ans.status_code, 200)

# def test_register(self):
# self.app = app.test_client()
# ans =self.app.get('/register')
# self.assertEqual(ans.status_code, 200)

# def test_dashboard(self):
# self.app = app.test_client()
# ans =self.app.get('/dashboard')
# self.assertEqual(ans.status_code, 200)

# def test_friends(self):
# self.app= app.test_client()
# ans=self.app.get('/friends')
# self.assertEqual(ans.status_code, 200)

# def test_calories(self):
# self.app= app.test_client()
# ans=self.app.get('/calories')
# self.assertEqual(ans.status_code, 302)
pass

# self.app = app.test_client()
# ans =self.app.get('/logout')
# self.assertEqual(ans.status_code, 200)
#
# def test_home(self):
# self.app = app.test_client()
# ans =self.app.get('/home')
# self.assertEqual(ans.status_code, 302)
#
# def test_login(self):
# self.app = app.test_client()
# ans =self.app.get('/login')
# self.assertEqual(ans.status_code, 200)
#
# def test_register(self):
# self.app = app.test_client()
# ans =self.app.get('/register')
# self.assertEqual(ans.status_code, 200)
#
# def test_dashboard(self):
# self.app = app.test_client()
# ans =self.app.get('/dashboard')
# self.assertEqual(ans.status_code, 200)
#
# def test_friends(self):
# self.app= app.test_client()
# ans=self.app.get('/friends')
# self.assertEqual(ans.status_code, 200)
#
# def test_calories(self):
# self.app= app.test_client()
# ans=self.app.get('/calories')
# self.assertEqual(ans.status_code, 200)
#
# def test_user_profile(self):
# self.app= app.test_client()
# ans=self.app.get('/user_profile')
# self.assertEqual(ans.status_code, 200)
#
# def test_history(self):
# self.app= app.test_client()
# ans=self.app.get('/history')
# self.assertEqual(ans.status_code, 200)

if __name__ == '__main__':
unittest.main()
19 changes: 19 additions & 0 deletions tests/test_profile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# import pytest
# from unittest.mock import patch
# from application import app
# import mongomock

# @pytest.fixture
# def client():
# with mongomock.patch():
# with app.test_client() as client:
# yield client

# def test_get_user_profile(client):
# db = mongomock.MongoClient().db

# db.items.insert_one(
# {"email":"[email protected]" ,"weight":90, "height":180, "target_weight":80,"goal":"75"},
# )
# response = client.get("/user_profile")
# assert response.status_code == 302
24 changes: 24 additions & 0 deletions tests/test_register.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import pytest
# from application import app

# @pytest.fixture
# def client():
# with mongomock.patch():
# with app.test_client() as client:
# yield client

# def test_get_user(client):
# db = mongomock.MongoClient().db
# db.items.insert_one(
# {"name": "OjasTest", "pwd":"hshaksjn", "weight":90, "height":180, "target_weight":80, "start_date":"2023-10-15", "target_date":
# "2023-11-15"},
# )
# response = client.get("/register")
# assert response.status_code == 200

# def test_insert_user(client):
# # Make a POST request to the /items endpoint with a JSON payload
# response = client.post("/register", json={"name": "OjasTest", "pwd":"hshaksjn", "weight":"90", "height":"180", "target_weight":"80", "start_date":"2023-10-15", "target_date":
# "2023-11-15"})
# # Assert the response status code is 201 Created
# assert response.status_code == 200

0 comments on commit 4f32300

Please sign in to comment.