Skip to content

Commit

Permalink
Updated as per the changes for editor and associate editor
Browse files Browse the repository at this point in the history
  • Loading branch information
RK206 committed Nov 7, 2023
1 parent 02ebc14 commit 8032a86
Showing 1 changed file with 44 additions and 8 deletions.
52 changes: 44 additions & 8 deletions doajtest/unit/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,42 @@
}
}

JOURNAL_QUERY_ROUTE = {
SEARCH_ALL_QUERY_ROUTE = {
"query" : {
"journal" : {
"auth" : False,
"role" : None,
"query_filters" : ["only_in_doaj", "search_all_meta"],
"query_filters" : ["search_all_meta"],
"dao" : "portality.models.Journal"
}
},
"editor_query" : {
"journal" : {
"auth" : True,
"role" : "editor",
"query_filters" : ["search_all_meta"],
"dao" : "portality.models.Journal"
},
"suggestion" : {
"auth" : False,
"role" : "editor",
"query_filters" : ["search_all_meta"],
"dao" : "portality.models.Application"
}
},
"associate_query": {
"journal": {
"auth": False,
"role": "associate_editor",
"query_filters" : ["search_all_meta"],
"dao": "portality.models.Journal"
},
"suggestion" : {
"auth" : False,
"role" : "associate_editor",
"query_filters" : ["search_all_meta"],
"dao" : "portality.models.Application"
}
}
}

Expand Down Expand Up @@ -412,7 +440,7 @@ def test_10_scroll(self):

def test_public_query_notes(self):

self.app_test.config['QUERY_ROUTE'] = JOURNAL_QUERY_ROUTE
self.app_test.config['QUERY_ROUTE'] = SEARCH_ALL_QUERY_ROUTE

self.get_journal_with_notes()

Expand Down Expand Up @@ -440,6 +468,8 @@ def test_admin_query_notes(self):

def test_editor_query_notes(self):

self.app_test.config['QUERY_ROUTE'] = SEARCH_ALL_QUERY_ROUTE

self.get_journal_with_notes()

editor = models.Account(**AccountFixtureFactory.make_editor_source())
Expand All @@ -455,10 +485,12 @@ def test_editor_query_notes(self):
'default_operator': 'AND'}}, 'size': 0, 'aggs': {'country_publisher':
{'terms': {'field': 'index.country.exact', 'size': 100, 'order': {'_count': 'desc'}}}},
'track_total_hits': True}, account=editor, additional_parameters={})
assert res['hits']['total']["value"] == 1, res['hits']['total']["value"]
assert res['hits']['total']["value"] == 0, res['hits']['total']["value"]

def test_associate_editor_query_notes(self):

self.app_test.config['QUERY_ROUTE'] = SEARCH_ALL_QUERY_ROUTE

self.get_journal_with_notes()

associate = models.Account(**AccountFixtureFactory.make_assed1_source())
Expand All @@ -474,10 +506,12 @@ def test_associate_editor_query_notes(self):
'default_operator': 'AND'}}, 'size': 0, 'aggs': {'country_publisher':
{'terms': {'field': 'index.country.exact', 'size': 100, 'order': {'_count': 'desc'}}}},
'track_total_hits': True}, account=associate, additional_parameters={})
assert res['hits']['total']["value"] == 1, res['hits']['total']["value"]
assert res['hits']['total']["value"] == 0, res['hits']['total']["value"]

def test_associate_editor_application_query_notes(self):

self.app_test.config['QUERY_ROUTE'] = SEARCH_ALL_QUERY_ROUTE

app = self.get_application_with_notes()

associate = models.Account(**AccountFixtureFactory.make_assed1_source())
Expand All @@ -494,10 +528,12 @@ def test_associate_editor_application_query_notes(self):
'default_operator': 'AND'}}, 'size': 0, 'aggs': {'country_publisher':
{'terms': {'field': 'index.country.exact', 'size': 100, 'order': {'_count': 'desc'}}}},
'track_total_hits': True}, account=associate, additional_parameters={})
assert res['hits']['total']["value"] == 1, res['hits']['total']["value"]
assert res['hits']['total']["value"] == 0, res['hits']['total']["value"]

def test_editor_application_query_notes(self):

self.app_test.config['QUERY_ROUTE'] = SEARCH_ALL_QUERY_ROUTE

app = self.get_application_with_notes()

editor = models.Account(**AccountFixtureFactory.make_editor_source())
Expand All @@ -514,9 +550,9 @@ def test_editor_application_query_notes(self):
'default_operator': 'AND'}}, 'size': 0, 'aggs': {'country_publisher':
{'terms': {'field': 'index.country.exact', 'size': 100, 'order': {'_count': 'desc'}}}},
'track_total_hits': True}, account=editor, additional_parameters={})
assert res['hits']['total']["value"] == 1, res['hits']['total']["value"]
assert res['hits']['total']["value"] == 0, res['hits']['total']["value"]

def test_editor_application_query_notes(self):
def test_admin_application_query_notes(self):

app = self.get_application_with_notes()

Expand Down

0 comments on commit 8032a86

Please sign in to comment.