Skip to content

Commit

Permalink
Merge pull request #13 from uw-it-aca/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jlaney authored Mar 4, 2024
2 parents b3a93b9 + 58d0873 commit 0beece7
Show file tree
Hide file tree
Showing 15 changed files with 60 additions and 53 deletions.
31 changes: 20 additions & 11 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ name: tests

env:
APP_NAME: uw_r25
COVERAGE_PYTHON_VERSION: '3.10'

on:
push:
Expand All @@ -37,22 +38,29 @@ on:

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

strategy:
matrix:
python-version:
- '3.8'
- '3.9'
- '3.10'

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

- name: Setup Python
uses: actions/setup-python@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: 3.6
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install commonconf nose2 coverage coveralls==2.2.0
pip install commonconf nose2 coverage coveralls==3.3.1
- name: Run Python Linters
uses: uw-it-aca/actions/python-linters@main
Expand All @@ -62,9 +70,10 @@ jobs:
- name: Run Tests
run: |
python -m compileall ${APP_NAME}/
coverage run ${APP_NAME}/test.py -v
python -Wd -m coverage run ${APP_NAME}/test.py -v
- name: Report Test Coverage
if: matrix.python-version == env.COVERAGE_PYTHON_VERSION
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
Expand All @@ -75,16 +84,16 @@ jobs:

needs: test

runs-on: ubuntu-18.04
runs-on: ubuntu-22.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@v4
with:
python-version: '3.x'
python-version: '3.10'

- name: Publish to PyPi
uses: uw-it-aca/actions/publish-pypi@main
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
[![Build Status](https://github.com/uw-it-aca/uw-restclients-r25/workflows/tests/badge.svg?branch=main)](https://github.com/uw-it-aca/uw-restclients-r25/actions)
[![Coverage Status](https://coveralls.io/repos/uw-it-aca/uw-restclients-r25/badge.svg?branch=main)](https://coveralls.io/r/uw-it-aca/uw-restclients-r25?branch=main)
[![PyPi Version](https://img.shields.io/pypi/v/uw-restclients-r25.svg)](https://pypi.python.org/pypi/uw-restclients-r25)
![Python versions](https://img.shields.io/pypi/pyversions/uw-restclients-r25.svg)

![Python versions](https://img.shields.io/badge/python-3.10-blue.svg)

Installation:

Expand Down
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
name='UW-RestClients-R25',
version=VERSION,
packages=['uw_r25'],
author="UW-IT AXDD",
author="UW-IT T&LS",
author_email="[email protected]",
include_package_data=True,
install_requires=[
'UW-RestClients-Core',
'lxml',
'lxml<5',
],
license='Apache License, Version 2.0',
description=('A library for connecting to the UW R25 API'),
Expand All @@ -33,6 +33,5 @@
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
],
)
2 changes: 1 addition & 1 deletion uw_r25/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from uw_r25.dao import R25_DAO
Expand Down
2 changes: 1 addition & 1 deletion uw_r25/dao.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

import logging
Expand Down
2 changes: 1 addition & 1 deletion uw_r25/events.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from uw_r25.models import Event, BindingReservation
Expand Down
2 changes: 1 addition & 1 deletion uw_r25/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from restclients_core import models
Expand Down
2 changes: 1 addition & 1 deletion uw_r25/reservations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from uw_r25.models import Reservation
Expand Down
2 changes: 1 addition & 1 deletion uw_r25/spaces.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from uw_r25.models import Space
Expand Down
2 changes: 1 addition & 1 deletion uw_r25/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

# This is just a test runner for coverage
Expand Down
4 changes: 2 additions & 2 deletions uw_r25/tests/test_dao.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from unittest import TestCase
Expand All @@ -11,7 +11,7 @@ class R25TestDao(TestCase):
def test_custom_headers(self):
self.assertFalse(R25_DAO()._custom_headers('GET', '/', {}, None))
with override_settings(RESTCLIENTS_R25_BASIC_AUTH='b64here'):
self.assertEquals(
self.assertEqual(
R25_DAO()._custom_headers('GET', '/', {}, None),
{'Authorization': 'Basic b64here'}
)
42 changes: 21 additions & 21 deletions uw_r25/tests/test_events.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from unittest import TestCase, skipIf
Expand All @@ -13,49 +13,49 @@ class R25TestEvents(TestCase):

def test_event_by_id(self):
event = get_event_by_id("100000")
self.assertEquals(event.event_id, "100000", "event_id")
self.assertEquals(event.name, "BOTHELL WINTER 2013 CABINET", "name")
self.assertEquals(event.title, "BOTHELL WINTER 2013 CABINET", "title")
self.assertEquals(event.alien_uid, None, "alien_uid")
self.assertEquals(event.start_date, "2013-01-01", "start_date")
self.assertEquals(event.end_date, "2013-03-28", "end_date")
self.assertEquals(event.state, "1", "state")
self.assertEquals(event.parent_id, None, "parent_id")
self.assertEquals(event.cabinet_id, event.event_id, "cabinet_id")
self.assertEquals(event.cabinet_name, event.name, "cabinet_name")
self.assertEquals(event.state_name(), "Tentative", "state_name")
self.assertEquals(len(event.reservations), 1, "reservations")
self.assertEquals(
self.assertEqual(event.event_id, "100000", "event_id")
self.assertEqual(event.name, "BOTHELL WINTER 2013 CABINET", "name")
self.assertEqual(event.title, "BOTHELL WINTER 2013 CABINET", "title")
self.assertEqual(event.alien_uid, None, "alien_uid")
self.assertEqual(event.start_date, "2013-01-01", "start_date")
self.assertEqual(event.end_date, "2013-03-28", "end_date")
self.assertEqual(event.state, "1", "state")
self.assertEqual(event.parent_id, None, "parent_id")
self.assertEqual(event.cabinet_id, event.event_id, "cabinet_id")
self.assertEqual(event.cabinet_name, event.name, "cabinet_name")
self.assertEqual(event.state_name(), "Tentative", "state_name")
self.assertEqual(len(event.reservations), 1, "reservations")
self.assertEqual(
len(event.binding_reservations), 1, "binding_reservations")

def test_parent_event(self):
event = get_event_by_id("100002")
parent = event.parent()
self.assertEquals(parent.event_id, event.parent_id, "parent_id")
self.assertEqual(parent.event_id, event.parent_id, "parent_id")

# No parent event
parent2 = parent.parent()
self.assertEquals(parent2, None, "parent_id")
self.assertEqual(parent2, None, "parent_id")

def test_child_events(self):
event = get_event_by_id("100000")
children = event.children()
self.assertEquals(len(children), 1, "child event count")
self.assertEqual(len(children), 1, "child event count")

# No child events
child = children[0]
children = child.children()
self.assertEquals(len(children), 0, "child event count")
self.assertEqual(len(children), 0, "child event count")

def test_cabinet_event(self):
event = get_event_by_id("100002")
cabinet = event.cabinet()
self.assertEquals(cabinet.event_id, event.cabinet_id, "cabinet_id")
self.assertEqual(cabinet.event_id, event.cabinet_id, "cabinet_id")

# cabinet is self
cabinet2 = cabinet.cabinet()
self.assertEquals(cabinet2.event_id, cabinet.event_id, "cabinet_id")
self.assertEqual(cabinet2.event_id, cabinet.event_id, "cabinet_id")

def test_all_events(self):
events = get_events()
self.assertEquals(len(events), 3, "event count")
self.assertEqual(len(events), 3, "event count")
2 changes: 1 addition & 1 deletion uw_r25/tests/test_reservations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from unittest import TestCase
Expand Down
10 changes: 5 additions & 5 deletions uw_r25/tests/test_spaces.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from unittest import TestCase
Expand All @@ -13,10 +13,10 @@ class R25TestSpaces(TestCase):

def test_space_by_id(self):
space = get_space_by_id("1000")
self.assertEquals(space.space_id, "1000", "space_id")
self.assertEquals(space.name, "ACC 120", "name")
self.assertEquals(space.formal_name, "Smith Hall", "formal_name")
self.assertEqual(space.space_id, "1000", "space_id")
self.assertEqual(space.name, "ACC 120", "name")
self.assertEqual(space.formal_name, "Smith Hall", "formal_name")

def test_all_spaces(self):
spaces = get_spaces()
self.assertEquals(len(spaces), 3, "space count")
self.assertEqual(len(spaces), 3, "space count")
2 changes: 1 addition & 1 deletion uw_r25/util/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from restclients_core.util.decorators import use_mock
Expand Down

0 comments on commit 0beece7

Please sign in to comment.