Skip to content

Commit

Permalink
Merge pull request #697 from shimilgithub/api-refactor
Browse files Browse the repository at this point in the history
Removing unique key constraint from parascriptural
  • Loading branch information
kavitharaju authored Sep 6, 2023
2 parents cdeb139 + 0530e6c commit e6a986e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
1 change: 0 additions & 1 deletion app/db_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ class Parascriptural():# pylint: disable=too-few-public-methods
createTime = Column('created_at', DateTime, default=ist_time)
updateTime = Column('last_updated_at', DateTime, onupdate= ist_time,default=ist_time)
__table_args__ = (
UniqueConstraint('category', 'title'),
{'extend_existing': True}
)
class SignBibleVideo():# pylint: disable=too-few-public-methods
Expand Down
28 changes: 14 additions & 14 deletions app/test/test_parascripturals.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,20 @@ def test_post_default():
assert len(data) == len(response.json()['data'])
return response,resource_name

def test_post_duplicate():
'''Negative test to add two parascripturals Links with same type and title'''
data = [
{'category':'Bible Stories', 'title':"the Gods reveals himself in new testament",
"link":"http://somewhere.com/new"}
]
resp, resource_name = check_post(data)
assert resp.status_code == 201
assert resp.json()['message'] == "Parascripturals added successfully"

data[0]['link'] = 'http://anotherplace/item'
response = client.post(UNIT_URL+resource_name, headers=headers_auth, json=data)
assert response.status_code == 409
assert response.json()['error'] == "Already Exists"
# def test_post_duplicate():
# '''Negative test to add two parascripturals Links with same type and title'''
# data = [
# {'category':'Bible Stories', 'title':"the Gods reveals himself in new testament",
# "link":"http://somewhere.com/new"}
# ]
# resp, resource_name = check_post(data)
# assert resp.status_code == 201
# assert resp.json()['message'] == "Parascripturals added successfully"

# data[0]['link'] = 'http://anotherplace/item'
# response = client.post(UNIT_URL+resource_name, headers=headers_auth, json=data)
# assert response.status_code == 409
# assert response.json()['error'] == "Already Exists"

def test_post_incorrect_data():
''' tests to check input validation in post API'''
Expand Down

0 comments on commit e6a986e

Please sign in to comment.