• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uw-it-aca / uw-restclients-bookstore / 11004134274

23 Sep 2024 11:35PM UTC coverage: 96.221% (-0.5%) from 96.726%
11004134274

Pull #34

github

fanglinfang
Merge branch 'develop' of https://github.com/uw-it-aca/uw-restclients-bookstore into develop
Pull Request #34: Develop

16 of 18 new or added lines in 3 files covered. (88.89%)

331 of 344 relevant lines covered (96.22%)

0.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.59
/uw_bookstore/digital_material.py
1
# Copyright 2024 UW-IT, University of Washington
2
# SPDX-License-Identifier: Apache-2.0
3

4
"""
1✔
5
This is the interface for interacting with the UW Bookstore's book service.
6
"""
7

8
import json
1✔
9
import logging
1✔
10
from uw_bookstore import DAO, Bookstore
1✔
11
from uw_bookstore.models import TermIACourse
1✔
12
from restclients_core.exceptions import DataFailureException
1✔
13

14
API_ENDPOINT = "/uw/iacourse_status.json?regid="
1✔
15
logger = logging.getLogger(__name__)
1✔
16

17

18
class IACoursesStatus(Bookstore):
1✔
19

20
    def get_iacourse_status(self, regid):
1✔
21
        url = "{}{}".format(API_ENDPOINT, regid)
1✔
22
        response = DAO.getURL(url, {"Accept": "application/json"})
1✔
23
        if response:
1✔
24
            logger.debug("get_iacourse_status {} =={}==> {}".format(
1✔
25
                url, response.status, response.data))
26
        if response.status != 200:
1✔
27
            raise DataFailureException(url, response.status, response.data)
1✔
28

29
        try:
1✔
30
            resp_json = json.loads(response.data)
1✔
NEW
31
        except Exception as ex:
×
NEW
32
            raise DataFailureException(
×
33
                url, response.status,
34
                {'exception': ex, 'data': response.data})
35

36
        terms_iacourses = {}
1✔
37
        if len(resp_json):
1✔
38
            for item in resp_json:
1✔
39
                tiac = TermIACourse(data=item)
1✔
40
                if tiac:
1✔
41
                    terms_iacourses[
1✔
42
                        "{}{}".format(tiac.quarter, tiac.year)] = tiac
43
        return terms_iacourses
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc