Skip to content

Commit

Permalink
Merge pull request #7 from uw-it-aca/task/spacews-v2
Browse files Browse the repository at this point in the history
update to v2
  • Loading branch information
fanglinfang committed Nov 14, 2022
2 parents f3b99fe + 2b096ff commit 0d2e49d
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 61 deletions.
7 changes: 4 additions & 3 deletions uw_space/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


import json
import logging
from restclients_core.exceptions import DataFailureException
from uw_space.dao import SPACE_DAO
from uw_space.models import Facility

by_code_path = "/space/v1/facility.json?facility_code={}"
by_number_path = "/space/v1/facility/{}.json"
by_code_path = "/space/v2/facility.json?facility_code={}"
by_number_path = "/space/v2/facility/{}.json"
logger = logging.getLogger(__name__)


Expand Down
3 changes: 2 additions & 1 deletion uw_space/dao.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


from restclients_core.dao import DAO
from os.path import abspath, dirname
import os
Expand Down
3 changes: 2 additions & 1 deletion uw_space/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


import json
from restclients_core import models
from uw_space.utils import date_to_str, str_to_datetime
Expand Down
45 changes: 0 additions & 45 deletions uw_space/resources/space/file/space/v1/facility/1347.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
"FacilityNumber": "1347",
"FacilityCode": "MEB",
"Description": "Mechanical Engr Bldg",
"Href": "/space/v1/facility/1347.json"
"Href": "/space/v2/facility/1347.json"
},
"FacilityNumber": "1347"
}],
"Current": {
"Href": "/space/v1/facility.json?facility_type=&facility_code=MEB&status=&aggregate_number=&site=&name=&long_name=&leased_or_owned=&street=&city=&state=&postal_code=&page_start=1&page_size=10",
"Href": "/space/v2/facility.json?facility_type=&facility_code=MEB&status=&aggregate_number=&site=&name=&long_name=&leased_or_owned=&street=&city=&state=&postal_code=&page_start=1&page_size=10",
"FacilityType": null,
"FacilityCode": "MEB",
"Status": null,
Expand Down
40 changes: 40 additions & 0 deletions uw_space/resources/space/file/space/v2/facility/1347.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"Addresses": [
{
"City": "Seattle",
"Code": "1",
"Country": "UNITED STATES",
"CountryCode2": "US",
"CountryCode3": "USA",
"County": "King",
"PostalCode": "98195",
"PrimaryAddress": "Y",
"State": "WA",
"StreetAddress": "3900 East Stevens Way NE"
}
],
"AggregateFacilityNumber": "1347",
"CenterPoint": {
"Href": "http://maps.google.com/maps?ll=47.6536929997,-122.304747",
"Latitude": 47.6536929997,
"Longitude": -122.304747
},
"FacilityCode": "MEB",
"FacilityNumber": "1347",
"FacilityType": {
"Code": "BLDG",
"Description": "Building"
},
"GrossSquareFeet": "97768",
"LeasedOrOwned": "OWNED",
"LongName": "Mechanical Engineering Building",
"ModifiedDate": "9/22/2022 7:41:34 PM",
"Name": "Mechanical Engr Bldg",
"RepositoryTimeStamp": "2022-09-22T13:23:30.908-07:00",
"Site": {
"Code": "SEA_MN",
"Description": "Seattle Main Campus"
},
"SpaceCount": 252,
"Status": "A"
}
3 changes: 2 additions & 1 deletion uw_space/test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


# This is just a test runner for coverage
from commonconf.backends import use_configparser_backend
from os.path import abspath, dirname
Expand Down
6 changes: 3 additions & 3 deletions uw_space/tests/test_dao.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


from unittest import TestCase
import mock
from commonconf import override_settings
Expand All @@ -16,5 +17,4 @@ def test_dao(self):
dao = SPACE_DAO()
self.assertEqual(dao.service_name(), "space")
self.assertTrue(
dao.service_mock_paths()[0].endswith(
"uw-restclients-space/uw_space/resources"))
dao.service_mock_paths()[0].endswith("/uw_space/resources"))
9 changes: 5 additions & 4 deletions uw_space/tests/test_facilities.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


from unittest import TestCase
from restclients_core.exceptions import DataFailureException
from uw_space import Facilities
from uw_space.utils import fdao_space_override

data = {
'code': 'MEB',
'last_updated': '2021-03-27 04:53:09',
'latitude': '47.653693',
'longitude': '-122.304747',
'last_updated': '2022-09-22 19:41:34',
'latitude': 47.6536929997,
'longitude': -122.304747,
'name': 'Mechanical Engineering Building',
'number': '1347',
'site': 'Seattle Main Campus',
Expand Down
3 changes: 2 additions & 1 deletion uw_space/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2022 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


from dateutil.parser import parse
from commonconf import override_settings

Expand Down

0 comments on commit 0d2e49d

Please sign in to comment.