Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Resolve #165: Classroomに劇の時間を追加 #302

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class Classroom(db.Model):
grade = db.Column(db.Integer)
index = db.Column(db.Integer)
title = db.Column(db.String(300))
begin_time = db.Column(db.Time)
end_time = db.Column(db.Time)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace


def __repr__(self):
return "<Classroom %r%r>".format(self.grade, self.get_classroom_name)
Expand Down
2 changes: 2 additions & 0 deletions api/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class ClassroomSchema(Schema):
index = fields.Int()
title = fields.Method("classroom_title", dump_only=True)
name = fields.Method("classroom_name", dump_only=True)
begin_time = fields.Time()
end_time = fields.Time()

def classroom_name(self, classroom):
return classroom.get_classroom_name()
Expand Down
9 changes: 9 additions & 0 deletions test/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,12 @@ def test_application_not_member(client):

dumpdata = application_schema.dump(member_app)[0]
assert not dumpdata['is_member']


def test_classroom_time(client):
with client.application.app_context():
target_classroom = Classroom.query.first()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined name 'Classroom'


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line contains whitespace
indentation contains mixed spaces and tabs
indentation contains tabs

dumpdata = classroom_schema.dump(target_classroom)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation contains mixed spaces and tabs
undefined name 'classroom_schema'

assert 'begin_time' in dumpdata
assert 'end_time' in dumpdata