Пример #1
0
func TestAnnouncements(t *testing.T) {
	actual, status, err := ada.Announcements("2014-2015-1-20750021-97")
	if err != nil {
		t.Fatalf("Failed to get announcements: %s", err)
	}

	util.ExpectStatus(t, status, http.StatusOK)

	// Check fetched data.
	expected := []*model.Announcement{
		{
			Id:        "1414652412222",
			CourseId:  "2014-2015-1-20750021-97",
			Owner:     &model.User{Name: "王媛"},
			CreatedAt: "2014-10-30",
			Priority:  0,
			Title:     "课程检索报告的要求",
			Body:      "<p><span style=\"word-wrap: break-word;\">?<span style=\"word-wrap: break-word; font-size: 7pt; font-family: &#39;Times New Roman&#39;;\">&nbsp; &nbsp; &nbsp; &nbsp;每位同学需要提交一份</span></span><span style=\"font-size: 10px;\">本课程综合检索报告。</span></p><p><span style=\"word-wrap: break-word;\">?<span style=\"word-wrap: break-word; font-size: 7pt; font-family: &#39;Times New Roman&#39;;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>综合报告总分值为50分。<br/></p><p><span style=\"word-wrap: break-word;\">?<span style=\"word-wrap: break-word; font-size: 7pt; font-family: &#39;Times New Roman&#39;;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>综合报告包括:选题背景分析(为什么选这个题目)、选题预期所要达成的目标、针对选题的检索步骤的细分、关于细分后的选题检索词的讨论、针对不同的选题分支的检索过程、检索效果的分析(是否符合自己的需求)以及通过对检索结果的阅读分析撰写综述,分析本课题未来可能有的研究方向等。</p><p><span style=\"word-wrap: break-word;\">?<span style=\"word-wrap: break-word; font-size: 7pt; font-family: &#39;Times New Roman&#39;;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>综合报告是在综合利用本课所讲资源的基础上完成,一般应包括图书、期刊、学位论文、事实数据、专利文献、专科词典、百科全书等多种文献类型。</p><p><span style=\"word-wrap: break-word;\">?<span style=\"word-wrap: break-word; font-size: 7pt; font-family: &#39;Times New Roman&#39;;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>本课旨在提高学生信息素养,鼓励大家在综合报告的最后一部分分享自己的信息使用心得,尤其是在学习、研究、社会交友等方面的网络工具,亦包括个人学习本课的体会和意见建议。</p><p><span style=\"word-wrap: break-word;\">?<span style=\"word-wrap: break-word; font-size: 7pt; font-family: &#39;Times New Roman&#39;;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>附加题:学有余力的同学,除以上综合大报告和个人小报告之外,还可以再做一个“研究者的检索影子报告”为附加作业,附加题的分值为5分。</p><p><span style=\"word-wrap: break-word;\">?<span style=\"word-wrap: break-word; font-size: 7pt; font-family: &#39;Times New Roman&#39;;\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>研究者的检索影子报告,是像影子一样观察、复制研究者的研究行为。如,去实验室找一个学长或者一个老师,观察他们的文献检索行为,问清楚他们要检索什么,去哪里检索,如何检索的,用的什么关键词,如何处理检索结果……观察者应该像影子一样,被观察者每做一步,都应该用文字或者图像记录下来。最终形成一份“研究者的影子”报告,观察者最后应该总结:被观察者的哪些检索行为是高效的,哪些行为是与文献检索课上讲的不一致的,甚至可以给被观察者一些检索建议。<br style=\"word-wrap: break-word;\"/><br style=\"word-wrap: break-word;\"/>所有作业不限字数,但内容太单薄肯定不合适,须言之有物、条分缕析、实事求是;切勿抄袭。<br style=\"word-wrap: break-word;\"/><br style=\"word-wrap: break-word;\"/>辛苦大家,有问题随时给我邮件。</p><p><br/></p>",
		},
		{
			Id:        "1413708226270",
			CourseId:  "2014-2015-1-20750021-97",
			Owner:     &model.User{Name: "王媛"},
			CreatedAt: "2014-10-19",
			Priority:  1,
			Title:     "第4次课预习内容",
			Body:      "<p>第4次课继续讲授《文献调研》的方法,学习“文摘索引数据库”,请大家预习Web of Science平台上的web of Science核心合集的使用方法。以第一次作业中你选取的题目为例,在wos核心合集中检索相关的论文。</p><p><br/></p><p>ps:没有在网络学堂中留下邮箱地址的同学请补充一下。</p>",
		},
		{
			Id:        "1413257641943",
			CourseId:  "2014-2015-1-20750021-97",
			Owner:     &model.User{Name: "王媛"},
			CreatedAt: "2014-10-14",
			Priority:  1,
			Title:     "第三次课预习题目",
			Body:      "<p>请使用清华大学图书馆数据库导航(http://nav.lib.tsinghua.edu.cn/xport/dbdh.htm),列举你的学科最常用的数据库,并尝试使用他们</p>",
		},
		{
			Id:        "1411868112836",
			CourseId:  "2014-2015-1-20750021-97",
			Owner:     &model.User{Name: "王媛"},
			CreatedAt: "2014-09-28",
			Priority:  1,
			Title:     "第二节预习内容",
			Body:      "<p>&nbsp;请尝试获得以下两篇期刊论文的全文。</p><p><br/></p><p>1.</p><p><a href=\"http://www.ncbi.nlm.nih.gov/pubmed/21941450\" target=\"_blank\"><span style=\"color: rgb(0, 0, 255); font-family: 宋体;\">Possibility of enhanced risk of retinal neovascularization in repeated blood donors: blood donation and retinal alteration.</span></a></p><p><span style=\"font-family: 宋体;\">Rastmanesh R.</span></p><p><span style=\"font-family: 宋体;\">Int J Gen Med. 2011;4:647-56. doi: 10.2147/IJGM.S23206. Epub 2011 Sep 6.</span></p><p></p><p>2.</p><p><a href=\"http://www.ncbi.nlm.nih.gov/pubmed/19373874\" target=\"_blank\"><span style=\"color: rgb(0, 0, 255); font-family: 宋体;\">Emerging drugs: mechanism of action, mass spectrometry and <strong>doping</strong> control analysis.</span></a></p><p><span style=\"font-family: 宋体;\">Thevis M, Thomas A, Kohler M, Beuck S, Sch?nzer W.</span></p><p><span style=\"font-family: 宋体;\">J Mass Spectrom. 2009 Apr;44(4):442-60. doi: 10.1002/jms.1584.</span></p><p></p>",
		},
		{
			Id:        "1411378457399",
			CourseId:  "2014-2015-1-20750021-97",
			Owner:     &model.User{Name: "王媛"},
			CreatedAt: "2014-09-22",
			Priority:  1,
			Title:     "第一讲---预习内容",
			Body:      "<p>本课第一讲将主要帮助大家正确认识文献信息源。请大家预习以下内容。</p><p><br/></p><p>查清华大学图书馆是否有“凌晓峰.学术研究:你的成功之道.北京 : 清华大学出版社, 2012”一书。</p><p>如有,告知馆藏地、索书号和馆藏状态。</p><p>本馆是否该书的英文版本?如何使用该书电子版?</p><p><br/></p><p>请大家使用图书馆馆藏目录查阅以上信息。课堂上我会随机点名抽查预习的效果哦。</p><p><br/></p><p>明天晚上见!</p><p><br/></p><p><br/></p>",
		},
	}

	util.ExpectDeepEqual(t, actual, expected)
}
Пример #2
0
func TestSemesters(t *testing.T) {
	thisSem, nextSem, status, err := ada.Semesters()

	if err != nil {
		t.Fatalf("Failed to get semesters: %s", err)
	}

	util.ExpectStatus(t, status, http.StatusOK)

	util.ExpectDeepEqual(t, thisSem.Id, "2015-2016-2")
	util.ExpectDeepEqual(t, nextSem.Id, "2015-2016-3")
}
Пример #3
0
func TestAllAttended(t *testing.T) {
	courses, status, err := ada.AllAttended(false)
	if err != nil {
		t.Fatalf("Failed to get attended courses: %s", err)
	}

	util.ExpectStatus(t, status, http.StatusOK)

	// Just test the last course.
	if len(courses) == 0 {
		t.Fatalf("Got no courses.")
	}
	actual := courses[len(courses)-1]
	expected := &model.Course{
		Id:          "2013-2014-1-00640252-96",
		SemesterId:  "2013-2014-1",
		Number:      "00640252",
		Sequence:    "96",
		Name:        "英语报刊选读",
		Credit:      2,
		Hour:        32,
		Description: "本课程将引导学生阅读当代英美报刊不同体裁的文章。使学生初步了解英美报刊文章的特点,学会识别不同体裁。在阅读能力提高的基础上,增强用英语表述自我观点的能力,从而加强批判性思维的能力。所选主题包括经济、环境、战争、科技、教育、社会、政府和体育,以及各类时事。要求学生自选5篇社论/专栏等文章写读书报告,完成5篇新闻总结。",
		Schedules: []*model.Schedule{
			{
				Weeks:    "全周",
				Day:      4,
				Slot:     1,
				Location: "六教6B105",
			},
		},
		Teachers: []*model.User{
			{
				Id:         "L064533",
				Name:       "Andrew Backe",
				Department: "外国语言文学系",
				Gender:     "男",
			},
		},
		Assistants: []*model.User{},
	}

	util.ExpectDeepEqual(t, actual, expected)
}
Пример #4
0
func TestProfile(t *testing.T) {
	actual, status, err := ada.Profile()
	if err != nil {
		t.Fatalf("Failed to get Profile: %s", err)
	}

	util.ExpectStatus(t, status, http.StatusOK)

	// Check fetched data.
	expected := &model.User{
		Id:         "2013011187",
		Name:       "李思涵",
		Department: "电子系",
		Class:      "无36",
		Gender:     "男",
		Email:      "*****@*****.**",
		Phone:      "18800183697",
	}

	util.ExpectDeepEqual(t, actual, expected)
}
Пример #5
0
func TestFiles(t *testing.T) {
	actual, status, err := ada.Files("127756")
	if err != nil {
		t.Fatalf("Failed to get files: %s", err)
	}
	if len(actual) < 17 {
		t.Fatalf("Files length (%d) too small", len(actual))
	}

	util.ExpectStatus(t, status, http.StatusOK)

	// Check fetched data.
	tab1file1 := &model.File{
		Id:          "1426717",
		CourseId:    "127756",
		CreatedAt:   "2015-09-13",
		Title:       "第1讲 操作系统引论(1)",
		Description: "",
		Category:    []string{"电子教案"},
		Filename:    "01操作系统引论(1)_178207362.pdf",
		Size:        2481982,
		DownloadURL: "https://learn.tsinghua.edu.cn/uploadFile/downloadFile_student.jsp?module_id=322\u0026filePath=N4Tel3ukBcf0P%2BxFdYeeoHN1562AESxTOYGA60sn5xpe9dkSxsvYaLcsha/n4FAm\u0026course_id=127756\u0026file_id=1426717",
	}

	tab2file1 := &model.File{
		Id:          "1429268",
		CourseId:    "127756",
		CreatedAt:   "2015-09-14",
		Title:       "现代操作系统(第三版)英文版",
		Description: "",
		Category:    []string{"补充资料"},
		Filename:    "modern_operating_systems_3rd_edition_tanenbaum_171607868.pdf",
		Size:        16402536,
		DownloadURL: "https://learn.tsinghua.edu.cn/uploadFile/downloadFile_student.jsp?module_id=322\u0026filePath=tAY6dAg1JH0INPji6josGqd/QGxTAbvadCvv0EfUnWw1ilm2qC/RZXchbtqC3FfuswFdhSOzbohNc8dms8TKZOiOp0KJm7vo8kXwiCOpbiSvRRDvZlFfPmDX4MQCdxbueQFju3W3qmM%3D\u0026course_id=127756\u0026file_id=1429268",
	}

	util.ExpectDeepEqual(t, actual[0], tab1file1)
	util.ExpectDeepEqual(t, actual[16], tab2file1)
}
Пример #6
0
func TestAllAttendedList(t *testing.T) {
	courses, status, err := ada.AllAttendedList()
	if err != nil {
		t.Fatalf("Failed to get all attended list: %s", err)
	}
	if len(courses) < 25 {
		t.Fatalf("All attended list length (%d) too small", len(courses))
	}

	util.ExpectStatus(t, status, http.StatusOK)

	testSet := []model.Course{
		{
			Id:         "132577",
			SemesterId: "2015-2016-2",
			Sequence:   "1",
			Name:       "三年级男生击剑",
		},
		{
			Id:         "108357",
			SemesterId: "2013-2014-2",
			Sequence:   "18",
			Name:       "中国近现代史纲要",
		},
		{
			Id:         "2014-2015-2-30230742-0",
			SemesterId: "2014-2015-2",
			Sequence:   "0",
			Name:       "概率论与随机过程 (1)",
		},
	}

	util.ExpectDeepEqual(t, courses[0], &testSet[0])
	util.ExpectDeepEqual(t, courses[len(courses)-1], &testSet[1])
	util.ExpectDeepEqual(t, courses[len(courses)-25], &testSet[2])
}
Пример #7
0
func TestFiles(t *testing.T) {
	actual, status, err := ada.Files("2014-2015-1-20750021-97")
	if err != nil {
		t.Fatalf("Failed to get files: %s", err)
	}

	util.ExpectStatus(t, status, http.StatusOK)

	// Check fetched data.
	expected := []*model.File{
		{
			Id:          "2004980851_2014-2015-1-20750021-97_KJ_1411486091",
			CourseId:    "2014-2015-1-20750021-97",
			Owner:       &model.User{Id: "2004980851", Name: "王媛"},
			CreatedAt:   "2014-09-23T23:28:13+0800",
			Title:       "全面认识文献信息源1",
			Description: "本讲中提到的工具:图书馆主页、馆藏目录、超星电子图书、读秀学术搜索、FirstSearch中的WorldCat联合目录。",
			Category:    []string{"课程文件", "电子教案"},
			Filename:    "文献检索与利用(理工类)-全面认识文献信息源.pptx",
			Size:        7935551,
			DownloadURL: "http://learn.cic.tsinghua.edu.cn/b/resource/downloadFileStream/2004980851_2014-2015-1-20750021-97_KJ_1411486091",
		},
		{
			Id:          "2004980851_2014-2015-1-20750021-97_KJ_1413292186",
			CourseId:    "2014-2015-1-20750021-97",
			Owner:       &model.User{Id: "2004980851", Name: "王媛"},
			CreatedAt:   "2014-10-14T21:09:47+0800",
			Title:       "全面认识文献信息源2",
			Description: "",
			Category:    []string{"课程文件", "电子教案"},
			Filename:    "文献检索与利用(理工类)-全面认识文献信息源2.pptx",
			Size:        3678507,
			DownloadURL: "http://learn.cic.tsinghua.edu.cn/b/resource/downloadFileStream/2004980851_2014-2015-1-20750021-97_KJ_1413292186",
		},
		{
			Id:          "2004980851_2014-2015-1-20750021-97_KJ_1413292258",
			CourseId:    "2014-2015-1-20750021-97",
			Owner:       &model.User{Id: "2004980851", Name: "王媛"},
			CreatedAt:   "2014-10-14T21:10:58+0800",
			Title:       "文献调研1",
			Description: "",
			Category:    []string{"课程文件", "电子教案"},
			Filename:    "文献检索与利用(3)--文献调研1.pptx",
			Size:        5154562,
			DownloadURL: "http://learn.cic.tsinghua.edu.cn/b/resource/downloadFileStream/2004980851_2014-2015-1-20750021-97_KJ_1413292258",
		},
		{
			Id:          "2004980851_2014-2015-1-20750021-97_KJ_1414651951",
			CourseId:    "2014-2015-1-20750021-97",
			Owner:       &model.User{Id: "2004980851", Name: "王媛"},
			CreatedAt:   "2014-10-30T14:52:32+0800",
			Title:       "文献调研SCI",
			Description: "",
			Category:    []string{"课程文件", "电子教案"},
			Filename:    "文献检索与利用(3)--文献调研2--SCI.pptx",
			Size:        4807443,
			DownloadURL: "http://learn.cic.tsinghua.edu.cn/b/resource/downloadFileStream/2004980851_2014-2015-1-20750021-97_KJ_1414651951",
		},
		{
			Id:          "2004980851_2014-2015-1-20750021-97_KJ_1414652071",
			CourseId:    "2014-2015-1-20750021-97",
			Owner:       &model.User{Id: "2004980851", Name: "王媛"},
			CreatedAt:   "2014-10-30T14:54:31+0800",
			Title:       "文献调研EI",
			Description: "",
			Category:    []string{"课程文件", "电子教案"},
			Filename:    "文献检索与利用(3)--文献调研3--EI.pptx",
			Size:        2275654,
			DownloadURL: "http://learn.cic.tsinghua.edu.cn/b/resource/downloadFileStream/2004980851_2014-2015-1-20750021-97_KJ_1414652071",
		},
	}

	util.ExpectDeepEqual(t, actual, expected)
}
Пример #8
0
func TestAssignments(t *testing.T) {
	actual, status, err := ada.Assignments("127743")
	if err != nil {
		t.Fatalf("Failed to get assignments: %s", err)
	}

	util.ExpectStatus(t, status, http.StatusOK)

	// Check fetched data.
	expected := []*model.Assignment{
		{
			Id:       "663857",
			CourseId: "127743",
			BeginAt:  "2015-11-02",
			DueAt:    "2015-11-05T23:59:59+0800",
			Title:    "第六次作业",
			Body:     "第六次作业有部分内容需要Matlab仿真,所以如果有同学想提交电子版作业,请把非仿真的部分也拍照一并提交上来,这样就可以不必提交纸版作业了。\n    如果有同学要提交纸板作业,请把仿真内容打印出来,在课堂上交给老师!",
			Submission: &model.Submission{
				AssignmentId: "663857",
				Late:         false,
				Body:         "",
				Attachment: &model.Attachment{
					Filename:    "2013011187_663857_873609575_p4.pdf",
					Size:        2820876,
					DownloadURL: "https://learn.tsinghua.edu.cn/uploadFile/downloadFile.jsp?module_id=322\u0026course_id=127743\u0026filePath=Ui6dWfN3E23iy92Lm3GqLolVIj%2Bu5tfsytg7jRwlhOqxaULAEWF80pMjNsAbeGoNLbxf932lsPZSeaPFGySxlzqYaxPQuvWF9JTL%2B1WuOg4%3D",
				},
				MarkedAt: "2015-11-06",
				Mark:     util.NewFloat32(9.5),
				Comment:  "第二题分析和结论正确,公式有问题。",
			},
		},
		{
			Id:       "667021",
			CourseId: "127743",
			BeginAt:  "2015-11-15",
			DueAt:    "2015-11-30T23:59:59+0800",
			Title:    "大作业",
			Body:     "作业说明件附件,参考论文和数据请从“课程文件”中下载。",
			Attachment: &model.Attachment{
				Filename:    "625602385_2_2015年《数字信号处理》课程大作业.pdf",
				Size:        112055,
				DownloadURL: "https://learn.tsinghua.edu.cn/uploadFile/downloadFile.jsp?module_id=322\u0026course_id=127743\u0026filePath=7D5eM/3uxuWgUscnZFe5xYFRwCtzmT3Nd4b8XfYdVt9QXP6jW0X3Mw6gr2ogb0t8bD67/q7AeDDvr3x32279mpdW6Tj5nS6ysO1fFyPcUzk%3D",
			},
			Submission: &model.Submission{
				AssignmentId: "667021",
				Late:         false,
				Body:         "",
				Attachment: &model.Attachment{
					Filename:    "2013011187_667021_531504538_report.pdf",
					Size:        98640,
					DownloadURL: "https://learn.tsinghua.edu.cn/uploadFile/downloadFile.jsp?module_id=322\u0026course_id=127743\u0026filePath=Ui6dWfN3E23iy92Lm3GqLolVIj%2Bu5tfsVetxSI%2BmeI5zL/GWM0GkxzPppRm00efUNVY7MLZOt3A1jm56tM3YdeAlZMTa30DiABpxaPmB1YI%3D",
				},
			},
		},
		{
			Id:       "669225",
			CourseId: "127743",
			BeginAt:  "2015-11-24",
			DueAt:    "2015-11-26T23:59:59+0800",
			Title:    "第九次作业",
			Body:     "",
		},
		{
			Id:       "670485",
			CourseId: "127743",
			BeginAt:  "2015-11-30",
			DueAt:    "2015-12-04T23:59:59+0800",
			Title:    "第十次作业",
			Body:     "请未交作业的同学尽快提交作业!",
		},
		{
			Id:       "672559",
			CourseId: "127743",
			BeginAt:  "2015-12-09",
			DueAt:    "2015-12-11T23:59:59+0800",
			Title:    "第十一次作业",
			Body:     "",
		},
		{
			Id:       "674369",
			CourseId: "127743",
			BeginAt:  "2015-12-15",
			DueAt:    "2015-12-18T23:59:59+0800",
			Title:    "第十二次作业",
			Body:     "",
		},
		{
			Id:       "675999",
			CourseId: "127743",
			BeginAt:  "2015-12-22",
			DueAt:    "2015-12-25T23:59:59+0800",
			Title:    "第十三次作业",
			Body:     "",
		},
		{
			Id:       "677925",
			CourseId: "127743",
			BeginAt:  "2015-12-30",
			DueAt:    "2016-01-01T23:59:59+0800",
			Title:    "第十四次作业",
			Body:     "",
			Submission: &model.Submission{
				AssignmentId: "677925",
				Late:         false,
				Body:         "助教你好,这是最后的三次作业(对于课件12,13,14,15),一起交上来了!",
				Attachment: &model.Attachment{
					Filename:    "2013011187_677925_351002502_课件12-15对应的作业.zip",
					Size:        13601942,
					DownloadURL: "https://learn.tsinghua.edu.cn/uploadFile/downloadFile.jsp?module_id=322\u0026course_id=127743\u0026filePath=Ui6dWfN3E23iy92Lm3GqLolVIj%2Bu5tfsAqZGEzdQ71%2BH77AyehAScSLl2e2n5PeFBbCCeknxk/vScQfKcoZU4o%2B/fgVxuHWOFnv5a2X8eUU%3D",
				},
				MarkedAt: "2016-01-03",
				Mark:     util.NewFloat32(9.5),
				Comment:  "前面三次各8分",
			},
		},
	}

	util.ExpectDeepEqual(t, actual, expected)
}
Пример #9
0
func TestAssignments(t *testing.T) {
	actual, status, err := ada.Assignments("2014-2015-1-20750021-97")
	if err != nil {
		t.Fatalf("Failed to get homeworks: %s", err)
	}

	util.ExpectStatus(t, status, http.StatusOK)

	// Check fetched data.
	expected := []*model.Assignment{
		{
			Id:         "58093",
			CourseId:   "2014-2015-1-20750021-97",
			CreatedAt:  "",
			BeginAt:    "2014-09-23T10:02:50+0800",
			DueAt:      "2014-09-23T18:59:59+0800",
			Title:      "第一节课预习作业:已经发了课程公告,为防止大家没看到",
			Body:       "<p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px; font-family: Tahoma, Helvetica, Arial, 微软雅黑, sans-serif; font-size: 12px; line-height: 22px; white-space: normal; background-color: rgb(255, 255, 255);\">重要:预习作业每人都要做,但不用交,我会课堂上随机抽查预习效果。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px; font-family: Tahoma, Helvetica, Arial, 微软雅黑, sans-serif; font-size: 12px; line-height: 22px; white-space: normal; background-color: rgb(255, 255, 255);\"><br/></p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px; font-family: Tahoma, Helvetica, Arial, 微软雅黑, sans-serif; font-size: 12px; line-height: 22px; white-space: normal; background-color: rgb(255, 255, 255);\">本课第一讲将主要帮助大家正确认识文献信息源。请大家预习以下内容。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px; font-family: Tahoma, Helvetica, Arial, 微软雅黑, sans-serif; font-size: 12px; line-height: 22px; white-space: normal; background-color: rgb(255, 255, 255);\"><br/></p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px; font-family: Tahoma, Helvetica, Arial, 微软雅黑, sans-serif; font-size: 12px; line-height: 22px; white-space: normal; background-color: rgb(255, 255, 255);\">查清华大学图书馆是否有“凌晓峰.学术研究:你的成功之道.北京 : 清华大学出版社, 2012”一书。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px; font-family: Tahoma, Helvetica, Arial, 微软雅黑, sans-serif; font-size: 12px; line-height: 22px; white-space: normal; background-color: rgb(255, 255, 255);\">如有,告知馆藏地、索书号和馆藏状态。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px; font-family: Tahoma, Helvetica, Arial, 微软雅黑, sans-serif; font-size: 12px; line-height: 22px; white-space: normal; background-color: rgb(255, 255, 255);\">本馆是否该书的英文版本?如何使用该书电子版?</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px; font-family: Tahoma, Helvetica, Arial, 微软雅黑, sans-serif; font-size: 12px; line-height: 22px; white-space: normal; background-color: rgb(255, 255, 255);\"><br/></p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px; font-family: Tahoma, Helvetica, Arial, 微软雅黑, sans-serif; font-size: 12px; line-height: 22px; white-space: normal; background-color: rgb(255, 255, 255);\">请大家使用图书馆馆藏目录查阅以上信息。课堂上我会随机点名抽查预习的效果哦。</p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px; font-family: Tahoma, Helvetica, Arial, 微软雅黑, sans-serif; font-size: 12px; line-height: 22px; white-space: normal; background-color: rgb(255, 255, 255);\"><br/></p><p style=\"margin-top: 0px; margin-bottom: 0px; padding: 0px; font-family: Tahoma, Helvetica, Arial, 微软雅黑, sans-serif; font-size: 12px; line-height: 22px; white-space: normal; background-color: rgb(255, 255, 255);\">晚上见!</p><p><br/></p>",
			Attachment: nil,
			Submission: nil,
		},
		{
			Id:         "71056",
			CourseId:   "2014-2015-1-20750021-97",
			CreatedAt:  "2014-10-14T21:18:04+0800",
			BeginAt:    "2014-10-14T00:00:00+0800",
			DueAt:      "2014-10-20T23:59:59+0800",
			Title:      "第一次作业:电子图书与检索式编写",
			Body:       "<p>请于10月20日前提交作业,电子版即可,可将两个题目做在一个ppt或word中,推荐使用ppt呈现。有不明白的请给我或助教发邮件。<br/></p>",
			Attachment: nil,
			Submission: &model.Submission{
				Owner:        &model.User{Id: "2013011187"},
				AssignmentId: "71056",
				CreatedAt:    "2014-10-20T23:50:27+0800",
				Late:         false,
				Body:         "",
				Attachment: &model.Attachment{
					Filename:    "作业1.pptx",
					Size:        315198,
					DownloadURL: "http://learn.cic.tsinghua.edu.cn/b/resource/downloadFileStream/2013011187_2014-2015-1-20750021-97_ZY_1413820224",
				},
				MarkedBy:          &model.User{Name: "汤娇"},
				MarkedAt:          "2014-10-23T23:12:39+0800",
				Mark:              util.NewFloat32(11),
				Comment:           "<p>作业一,缺少分享一部分,此次不扣分,请再试一下如何将下载的图书拷贝给别人使用,另外关于超星电子图书阅读器的注册和下载过程的展示过于简略,;作业二,中文检索式连接符的使用正确,但是检索词的选择过于生僻和口语化,导致你的检索结果没有,英文检索式错误,请注意括号需要成对出现和检索词的选择.</p>",
				CommentAttachment: nil,
			},
		},
		{
			Id:        "76121",
			CourseId:  "2014-2015-1-20750021-97",
			CreatedAt: "2014-10-22T17:19:10+0800",
			BeginAt:   "2014-10-22T00:00:00+0800",
			DueAt:     "2014-11-01T23:59:59+0800",
			Title:     "第二次作业——SCI",
			Body:      "<p>课件我传不上去,只要放在印象笔记中与大家共享,请大家通过这个链接<a href=\"http://app.yinxiang.com/l/AAmpP7Z7r6lKnqrhVrtaVajvcJNd__J4xEA/\">http://app.yinxiang.com/l/AAmpP7Z7r6lKnqrhVrtaVajvcJNd__J4xEA/</a>&nbsp;来下载,以前和以后的课件我多会放在这里。请大家按时完成作业。</p>",
			Attachment: &model.Attachment{
				Filename:    "文献检索与利用-第二次作业——SCI.docx",
				Size:        15832,
				DownloadURL: "http://learn.cic.tsinghua.edu.cn/b/resource/downloadFileStream/2004980851_2014-2015-1-20750021-97_ZY_1413969147",
			},
			Submission: &model.Submission{
				Owner:        &model.User{Id: "2013011187"},
				AssignmentId: "76121",
				CreatedAt:    "2014-11-01T23:58:44+0800",
				Late:         false,
				Body:         "",
				Attachment: &model.Attachment{
					Filename:    "文献检索与利用-第二次作业——SCI.docx",
					Size:        250204,
					DownloadURL: "http://learn.cic.tsinghua.edu.cn/b/resource/downloadFileStream/2013011187_2014-2015-1-20750021-97_ZY_1414857519",
				},
				MarkedBy:          &model.User{Name: "汤娇"},
				MarkedAt:          "2014-11-11T18:26:26+0800",
				Mark:              util.NewFloat32(8),
				Comment:           "<p><span style=\"font-size:14px;font-family:宋体\">李思涵,你好:</span></p><p><span style=\"font-size:14px;font-family:宋体\"><br/></span></p><p><span style=\"font-size:14px;font-family:宋体\">&nbsp; &nbsp;第二次作业已阅,完成得不是很理想,你可以通过优化一下你的检索式,来获得最适合你的检索结果,可以适当放开你的检索条件;否则你第三题你如何完成这部分的作业;有问题的话,请联系王老师和我.</span></p><p><span style=\"font-size:14px;font-family:宋体\"><br/></span></p><p><span style=\"font-size:14px;font-family:宋体\">&nbsp; 继续努力,将后续的作业做好!</span></p><p><span style=\"font-size:14px;font-family:宋体\"><br/></span></p><p><span style=\"font-size:14px;font-family:宋体\">汤娇</span></p>",
				CommentAttachment: nil,
			},
		},
		{
			Id:        "88053",
			CourseId:  "2014-2015-1-20750021-97",
			CreatedAt: "2014-10-30T14:56:19+0800",
			BeginAt:   "2014-10-30T00:00:00+0800",
			DueAt:     "2014-11-14T23:59:59+0800",
			Title:     "EI",
			Body:      "",
			Attachment: &model.Attachment{
				Filename:    "EI作业.doc",
				Size:        32256,
				DownloadURL: "http://learn.cic.tsinghua.edu.cn/b/resource/downloadFileStream/2004980851_2014-2015-1-20750021-97_ZY_1414652158",
			},
			Submission: &model.Submission{
				Owner:        &model.User{Id: "2013011187"},
				AssignmentId: "88053",
				CreatedAt:    "2014-11-14T11:17:18+0800",
				Late:         false,
				Body:         "",
				Attachment: &model.Attachment{
					Filename:    "EI作业.doc",
					Size:        36352,
					DownloadURL: "http://learn.cic.tsinghua.edu.cn/b/resource/downloadFileStream/2013011187_2014-2015-1-20750021-97_ZY_1415935032",
				},
				MarkedBy:          &model.User{Name: "汤娇"},
				MarkedAt:          "2014-11-19T21:11:44+0800",
				Mark:              util.NewFloat32(14),
				Comment:           "<p style=\"TEXT-ALIGN: left; MARGIN: 0px 0px 5px\"><span style=\"FONT-FAMILY: 宋体; COLOR: black; FONT-SIZE: 16px\">李思涵,你好:</span></p><p style=\"TEXT-ALIGN: left; MARGIN: 5px 0px\"><span style=\"FONT-FAMILY: 宋体; COLOR: black; FONT-SIZE: 16px\">&nbsp;&nbsp;&nbsp;&nbsp; </span></p><p style=\"TEXT-ALIGN: left; MARGIN: 5px 0px\"><span style=\"FONT-FAMILY: 宋体; COLOR: black; FONT-SIZE: 16px\">&nbsp;&nbsp;&nbsp;&nbsp; EI</span><span style=\"FONT-FAMILY: 宋体; COLOR: black; FONT-SIZE: 16px\">作业已阅,总体完成得不错,过程和思路也比较清晰,但是按照你的expert search,应该只有4个检索结果。</span></p><p style=\"TEXT-ALIGN: left; MARGIN: 5px 0px\"><span style=\"FONT-FAMILY: 宋体; COLOR: black; FONT-SIZE: 16px\">&nbsp;&nbsp;&nbsp;&nbsp; </span><span style=\"FONT-FAMILY: 宋体; COLOR: black; FONT-SIZE: 16px\">继续努力,将检索报告好好完成!</span><span style=\"FONT-FAMILY: &#39;Arial&#39;,&#39;sans-serif&#39;; FONT-SIZE: 16px\">&nbsp;</span></p><p style=\"TEXT-ALIGN: left; MARGIN: 5px 0px\"><span style=\"FONT-FAMILY: 宋体; COLOR: black; FONT-SIZE: 16px\">&nbsp;</span><span style=\"FONT-FAMILY: 宋体; COLOR: black; FONT-SIZE: 16px\">汤娇</span></p><p></p>",
				CommentAttachment: nil,
			},
		},
		{
			Id:         "92095",
			CourseId:   "2014-2015-1-20750021-97",
			CreatedAt:  "2014-11-15T15:27:16+0800",
			BeginAt:    "2014-11-15T00:00:00+0800",
			DueAt:      "2014-12-01T23:59:59+0800",
			Title:      "综合检索报告提交专用",
			Body:       "",
			Attachment: nil,
			Submission: &model.Submission{
				Owner:        &model.User{Id: "2013011187"},
				AssignmentId: "92095",
				CreatedAt:    "2014-12-02T13:21:56+0800",
				Late:         true,
				Body:         "",
				Attachment: &model.Attachment{
					Filename:    "final.pdf",
					Size:        223372,
					DownloadURL: "http://learn.cic.tsinghua.edu.cn/b/resource/downloadFileStream/2013011187_2014-2015-1-20750021-97_ZY_1417497712",
				},
				MarkedBy:          &model.User{Name: "王媛"},
				MarkedAt:          "2015-02-01T22:16:25+0800",
				Mark:              util.NewFloat32(38),
				Comment:           "",
				CommentAttachment: nil,
			},
		},
	}

	util.ExpectDeepEqual(t, actual, expected)
}
Пример #10
0
func TestAnnouncements(t *testing.T) {
	actual, status, err := ada.Announcements("103048")
	if err != nil {
		t.Fatalf("Failed to get announcements: %s", err)
	}

	util.ExpectStatus(t, status, http.StatusOK)

	// Check fetched data.
	expected := []*model.Announcement{
		{
			Id:        "1535567",
			CourseId:  "103048",
			Owner:     &model.User{Name: "孙甲松", Email: "*****@*****.**"},
			CreatedAt: "2013-12-31",
			Priority:  1,
			Title:     "期末考试时间地点",
			Body:      "<font size=\"6\">考试时间:1月18日上午8:00~9:00<br/>考试地点:一教101     学号:2012011072~2013011167<br/>                  一教104     学号:2013011168~2013080069</font>",
		},
		{
			Id:        "1481094",
			CourseId:  "103048",
			Owner:     &model.User{Name: "陈权崎"},
			CreatedAt: "2013-10-16",
			Priority:  0,
			Title:     "捡到一个U盘",
			Body:      "黄永峰老师的程序设计助教陶怀舟在机房捡到一个U盘,有丢失U盘的同学可以去罗姆楼8-203或者周五晚上上机时间到机房找陶怀舟查看。",
		},
		{
			Id:        "1466904",
			CourseId:  "103048",
			Owner:     &model.User{Name: "孙甲松", Email: "*****@*****.**"},
			CreatedAt: "2013-09-26",
			Priority:  1,
			Title:     "《C程序设计教程》马上到教材中心",
			Body:      "<font size=\"5\">教材中心通知:《C程序设计教程》今天下午4点后到教材中心,大家可以以班级或者个人去购买。<br/>请相互转告!</font>",
		},
		{
			Id:        "1466172",
			CourseId:  "103048",
			Owner:     &model.User{Name: "孙甲松", Email: "*****@*****.**"},
			CreatedAt: "2013-09-25",
			Priority:  1,
			Title:     "注意:C语言02课件已经更新",
			Body:      "<p><font size=\"4\">注意:C语言02课件已经更新,第2次实验中,98.6875改为97.6875,以与教材和ppt中所给示例的值保持一致。抱歉给大家添乱!<br/><br/>1.编写程序打印查看<font color=\"#ff0000\">97.6875</font>的double型值在计算机内的IEEE 754 存储格式按字节的十六进制值,验证是否与教材所给结果一致。同时也打印查看97.6875的float型值在计算机内存储按字节的十六进制值。</font></p>",
		},
		{
			Id:        "1463882",
			CourseId:  "103048",
			Owner:     &model.User{Name: "孙甲松", Email: "*****@*****.**"},
			CreatedAt: "2013-09-23",
			Priority:  1,
			Title:     "分组与助教联系方式",
			Body:      "<font size=\"4\">所有同学被分成4组,每人有一个组号,由学号所在的范围决定,与班号无关。<br/>第1组:2012011072~2013011110<font size=\"4\"><br/>第2组:2013011112~2013011167<br/></font><font size=\"4\">第3组:2013011168~2013011234</font><font size=\"4\"><br/>第4组:2013011236~2013080069<br/></font><br/>以下4位助教分别负责批改第1~第4组作业:<br/>第1组(2012011072~2013011110):陈权崎  13810323433    </font><a href=\"mailto:[email protected]\"><font size=\"4\">[email protected]</font></a><font size=\"4\">     <br/>第2组(2013011112~2013011167):李雪      13488687568    </font><a style=\"FONT-SIZE: 14px; FONT-FAMILY: arial,sans-serif\" target=\"_blank\" href=\"mailto:[email protected]\"><font size=\"4\">[email protected]</font></a><font size=\"4\">     <br/>第3组(2013011168~2013011234):张蕤      15120083955    </font><a href=\"mailto:[email protected]\"><font size=\"4\">[email protected]</font></a><font size=\"4\">     <br/>第4组(2013011236~2013080069):王斌      15120001254    </font><a href=\"mailto:[email protected]\"><font size=\"4\">[email protected]</font></a><font size=\"4\">  <br/><br/>有问题请与他们联系。</font><br/>",
		},
		{
			Id:        "1463860",
			CourseId:  "103048",
			Owner:     &model.User{Name: "孙甲松", Email: "*****@*****.**"},
			CreatedAt: "2013-09-23",
			Priority:  1,
			Title:     "提交作业或者实验报告后请检查附件大小!",
			Body:      "<font size=\"4\">各位同学,提交作业或者实验报告后请检查附件大小!如果出现文件长度为0或者“无附件”,说明提交不成功,请重新提交! 切记!</font>",
		},
		{
			Id:        "1460655",
			CourseId:  "103048",
			Owner:     &model.User{Name: "孙甲松", Email: "*****@*****.**"},
			CreatedAt: "2013-09-18",
			Priority:  1,
			Title:     "关于前两次纸值作业",
			Body:      "<font size=\"4\">第一、二次纸值作业,最好以班级为单位收齐,下次上课时由课代表交给我,我转交给助教。<br/>其余的作业和实验,请在网络学堂中的“课程作业”里提交电子版。请相互转告!</font>",
		},
		{
			Id:        "1460638",
			CourseId:  "103048",
			Owner:     &model.User{Name: "孙甲松", Email: "*****@*****.**"},
			CreatedAt: "2013-09-18",
			Priority:  1,
			Title:     "实验写报告提交到网络学堂中",
			Body:      "<font size=\"3\">各位同学,<br/><br/>以后的实验以及第三次以后的作业,都写一个电子文档 (.doc 或.docx) <strong>提交到网络学堂中</strong>,</font><font size=\"3\"><strong>注意:不要发到我的邮箱中!<br/></strong>因为助教负责批改作业,不提交到网络学堂中他们看不到,无法给成绩。<br/>即使已经用邮件发给我的同学,也请到网络学堂中提交。请相互转告!<br/><br/>文档内容:<br/>6.     源程序: 。。。。。。。。<br/>       运行结果:(截图或者结果)<br/>7.     源程序: 。。。。。。。。<br/>       运行结果:(截图或者结果)<br/><br/>如果是实验,要求写<strong>实验报告</strong>,请按<strong>实验报告的格式</strong>写:<br/>题目:。。。。。。<br/>源程序:。。。。。。。。<br/>运行结果:(截图或者结果)<br/>结果分析与总结:.。。。。。。。。。</font>",
		},
	}

	util.ExpectDeepEqual(t, actual, expected)
}