Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8760efc

Browse files
committed
test: added tests for statistics
1 parent8c84cbf commit8760efc

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

‎gitlab/tests/test_gitlab.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,62 @@ def resp_get_environment(url, request):
553553
self.assertEqual(environment.last_deployment,"sometime")
554554
self.assertEqual(environment.name,"environment_name")
555555

556+
deftest_project_additional_statistics(self):
557+
@urlmatch(
558+
scheme="http",netloc="localhost",path="/api/v4/projects/1$",method="get"
559+
)
560+
defresp_get_project(url,request):
561+
headers= {"content-type":"application/json"}
562+
content='{"name": "name", "id": 1}'.encode("utf-8")
563+
returnresponse(200,content,headers,None,5,request)
564+
565+
@urlmatch(
566+
scheme="http",
567+
netloc="localhost",
568+
path="/api/v4/projects/1/statistics",
569+
method="get",
570+
)
571+
defresp_get_environment(url,request):
572+
headers= {"content-type":"application/json"}
573+
content="""{"fetches": {"total": 50, "days": [{"count": 10, "date": "2018-01-10"}]}}""".encode(
574+
"utf-8"
575+
)
576+
returnresponse(200,content,headers,None,5,request)
577+
578+
withHTTMock(resp_get_project,resp_get_environment):
579+
project=self.gl.projects.get(1)
580+
statistics=project.additionalstatistics.get()
581+
self.assertIsInstance(statistics,ProjectAdditionalStatistics)
582+
self.assertEqual(statistics.fetches["total"],50)
583+
584+
deftest_project_issues_statistics(self):
585+
@urlmatch(
586+
scheme="http",netloc="localhost",path="/api/v4/projects/1$",method="get"
587+
)
588+
defresp_get_project(url,request):
589+
headers= {"content-type":"application/json"}
590+
content='{"name": "name", "id": 1}'.encode("utf-8")
591+
returnresponse(200,content,headers,None,5,request)
592+
593+
@urlmatch(
594+
scheme="http",
595+
netloc="localhost",
596+
path="/api/v4/projects/1/issues_statistics",
597+
method="get",
598+
)
599+
defresp_get_environment(url,request):
600+
headers= {"content-type":"application/json"}
601+
content="""{"statistics": {"counts": {"all": 20, "closed": 5, "opened": 15}}}""".encode(
602+
"utf-8"
603+
)
604+
returnresponse(200,content,headers,None,5,request)
605+
606+
withHTTMock(resp_get_project,resp_get_environment):
607+
project=self.gl.projects.get(1)
608+
statistics=project.issuesstatistics.get()
609+
self.assertIsInstance(statistics,ProjectIssuesStatistics)
610+
self.assertEqual(statistics.statistics["counts"]["all"],20)
611+
556612
deftest_groups(self):
557613
@urlmatch(
558614
scheme="http",netloc="localhost",path="/api/v4/groups/1",method="get"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp