Skip to content

Commit

Permalink
Merge pull request #9 from uw-it-aca/qa
Browse files Browse the repository at this point in the history
Add building status
  • Loading branch information
fanglinfang committed Aug 4, 2023
2 parents 417a97d + 509d0a9 commit c67b653
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 17 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ on:

jobs:
test:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: 3.6
python-version: 3.8

- name: Install Dependencies
run: |
Expand Down Expand Up @@ -75,16 +75,16 @@ jobs:

needs: test

runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: '3.x'
python-version: 3.8

- name: Publish to PyPi
uses: uw-it-aca/actions/publish-pypi@main
Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2023 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

import os
from setuptools import setup

Expand Down Expand Up @@ -35,6 +38,6 @@
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.8',
],
)
4 changes: 3 additions & 1 deletion uw_space/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 UW-IT, University of Washington
# Copyright 2023 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


Expand Down Expand Up @@ -49,9 +49,11 @@ def __process_json(self, json_data):
objs = []
facilitys = json_data.get("Facilitys")
for facility in facilitys:
status = facility.get("Status")
fnumber = facility.get("FacilityNumber")
if fnumber and len(fnumber):
fac = self.search_by_number(fnumber)
if fac:
fac.status = status
objs.append(fac)
return objs
2 changes: 1 addition & 1 deletion uw_space/dao.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 UW-IT, University of Washington
# Copyright 2023 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


Expand Down
5 changes: 3 additions & 2 deletions uw_space/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 UW-IT, University of Washington
# Copyright 2023 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


Expand All @@ -16,6 +16,7 @@ class Facility(models.Model):
number = models.CharField(max_length=16)
type = models.CharField(max_length=32)
site = models.CharField(max_length=96)
status = models.CharField(max_length=64)

def __init__(self, *args, **kwargs):
super(Facility, self).__init__(*args, **kwargs)
Expand All @@ -27,7 +28,6 @@ def from_json(json_data):
obj.number = json_data.get("FacilityNumber")
obj.last_updated = str_to_datetime(json_data.get("ModifiedDate"))
obj.name = json_data.get("LongName")

cpoint = json_data.get("CenterPoint")
if cpoint:
obj.latitude = cpoint.get("Latitude")
Expand All @@ -51,6 +51,7 @@ def json_data(self):
"name": self.name,
"number": self.number,
"site": self.site,
"status": self.status,
"type": self.type,
}

Expand Down
2 changes: 1 addition & 1 deletion uw_space/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 UW-IT, University of Washington
# Copyright 2023 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


Expand Down
2 changes: 1 addition & 1 deletion uw_space/tests/test_dao.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 UW-IT, University of Washington
# Copyright 2023 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


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


Expand All @@ -24,6 +24,7 @@ class TestSpace(TestCase):
def test_search_by_code(self):
fac = Facilities().search_by_code("MEB")
self.assertEqual(len(fac), 1)
data['status'] = 'A'
self.assertEqual(fac[0].json_data(), data)

self.assertRaises(
Expand All @@ -33,6 +34,7 @@ def test_search_by_code(self):

def test_search_by_number(self):
fac = Facilities().search_by_number("1347")
data['status'] = ''
self.assertEqual(fac.json_data(), data)

self.assertRaises(
Expand Down
2 changes: 1 addition & 1 deletion uw_space/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 UW-IT, University of Washington
# Copyright 2023 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0


Expand Down

0 comments on commit c67b653

Please sign in to comment.