Skip to content

Commit

Permalink
Rename current_murs module to current_cases
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeaufort committed Sep 6, 2018
1 parent b7726c7 commit 05c68b0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions tests/test_current_murs.py → tests/test_current_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest

from webservices import rest
from webservices.legal_docs.current_murs import (
from webservices.legal_docs.current_cases import (
get_cases,
parse_regulatory_citations,
parse_statutory_citations,
Expand Down Expand Up @@ -115,7 +115,7 @@ def tearDown(self):
self.connection.close()
rest.db.session.remove()

@patch('webservices.legal_docs.current_murs.get_bucket')
@patch('webservices.legal_docs.current_cases.get_bucket')
def test_simple_mur(self, get_bucket):
mur_subject = 'Fraudulent misrepresentation'
expected_mur = {
Expand All @@ -142,7 +142,7 @@ def test_simple_mur(self, get_bucket):
assert actual_mur == expected_mur

@patch('webservices.env.env.get_credential', return_value='BUCKET_NAME')
@patch('webservices.legal_docs.current_murs.get_bucket')
@patch('webservices.legal_docs.current_cases.get_bucket')
def test_mur_with_participants_and_documents(self, get_bucket, get_credential):
case_id = 1
mur_subject = 'Fraudulent misrepresentation'
Expand Down Expand Up @@ -188,7 +188,7 @@ def test_mur_with_participants_and_documents(self, get_bucket, get_credential):
(d['category'], d['text'], d['length']) for d in actual_mur['documents']]

@patch('webservices.env.env.get_credential', return_value='BUCKET_NAME')
@patch('webservices.legal_docs.current_murs.get_bucket')
@patch('webservices.legal_docs.current_cases.get_bucket')
def test_mur_with_disposition(self, get_bucket, get_credential):
case_id = 1
case_no = '1'
Expand Down Expand Up @@ -275,7 +275,7 @@ def test_mur_with_disposition(self, get_bucket, get_credential):
}
assert actual_mur == expected_mur

@patch('webservices.legal_docs.current_murs.get_bucket')
@patch('webservices.legal_docs.current_cases.get_bucket')
def test_mur_offsets(self, get_bucket):
mur_subject = 'Fraudulent misrepresentation'
expected_mur1 = {
Expand Down
2 changes: 1 addition & 1 deletion webservices/legal_docs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys

from .advisory_opinions import load_advisory_opinions
from .current_murs import load_current_murs, load_adrs, load_admin_fines
from .current_cases import load_current_murs, load_adrs, load_admin_fines

logging.basicConfig(level=logging.INFO, stream=sys.stdout)
logger = logging.getLogger('elasticsearch')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ def load_adrs(case_no=None):
def load_admin_fines(case_no=None):
load_current_cases(case_no, 'AF')


def get_es_type(case_type):
if case_type == 'AF':
return 'admin_fines'
Expand All @@ -145,10 +144,11 @@ def get_es_type(case_type):

def load_current_cases(case_no=None, case_type=None):
"""
Reads data for current MURs from a Postgres database, assembles a JSON document
corresponding to the MUR and indexes this document in Elasticsearch in the index
`docs_index` with a doc_type of `murs`. In addition, all documents attached to
the MUR are uploaded to an S3 bucket under the _directory_ `legal/murs/current/`.
Reads data for current MURs, AFs, or ADR cases (depending on case_type)
from a Postgres database, assembles a JSON document
corresponding to the case and indexes this document in Elasticsearch
in the index `docs_index` with a doc_type corresponding to case_type.
In addition, all documents attached to the case are uploaded to an S3 bucket under the _directory_ `legal/<doc_type>/current/`.
"""
es = get_elasticsearch_connection()
logger.info("Loading current {0}(s)".format(case_type))
Expand All @@ -163,9 +163,9 @@ def load_current_cases(case_no=None, case_type=None):

def get_cases(case_no=None, case_type=None):
"""
Takes a specific MUR to load.
If none are specified, all MURs are reloaded
Unlike AOs, MURs are not published in sequential order.
Takes a specific case to load.
If none are specified, all cases are reloaded
Unlike AOs, cases are not published in sequential order.
"""
if case_no is None:
with db.engine.connect() as conn:
Expand Down
2 changes: 1 addition & 1 deletion webservices/tasks/legal_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from webservices import utils
from webservices.legal_docs.advisory_opinions import load_advisory_opinions
from webservices.legal_docs.current_murs import load_current_murs
from webservices.legal_docs.current_cases import load_current_murs
from webservices.rest import db
from webservices.tasks import app
from webservices.tasks.utils import get_app_name
Expand Down

0 comments on commit 05c68b0

Please sign in to comment.