ソースを参照

Better api test naming

Guénaël Muller 7 年 前
コミット
2ecf59588e
共有2 個のファイルを変更した12 個の追加10 個の削除を含む
  1. 3 3
      tracim/tests/functional/test_doc.py
  2. 9 7
      tracim/tests/functional/test_session.py

+ 3 - 3
tracim/tests/functional/test_doc.py ファイルの表示

@@ -3,15 +3,15 @@ from tracim.tests import FunctionalTest
3 3
 
4 4
 class TestDoc(FunctionalTest):
5 5
 
6
-    def test_index(self):
6
+    def test_api__check_doc_index_html_page__ok_200__nominal_case(self):
7 7
         res = self.testapp.get('/api/v2/doc/', status=200)
8 8
         assert res.content_type == 'text/html'
9 9
 
10
-    def test_spec_yml(self):
10
+    def test_api__check_spec_yaml_file__ok_200__nominal_case(self):
11 11
         res = self.testapp.get('/api/v2/doc/spec.yml', status=200)
12 12
         assert res.content_type == 'text/x-yaml'
13 13
 
14
-    def test_assets(self):
14
+    def test_api__check_docs_assets__ok_200__nominal_case(self):
15 15
         res = self.testapp.get(
16 16
             '/api/v2/doc/favicon-32x32.png',
17 17
             status=200,

+ 9 - 7
tracim/tests/functional/test_session.py ファイルの表示

@@ -6,14 +6,16 @@ from tracim.tests import FunctionalTest
6 6
 
7 7
 class TestLogoutEndpoint(FunctionalTest):
8 8
 
9
-    def test_logout(self):
9
+    def test_api__access_logout_get_enpoint__ok__nominal_case(self):
10 10
         res = self.testapp.post_json('/api/v2/sessions/logout', status=204)
11
+
12
+    def test_api__access_logout_post_enpoint__ok__nominal_case(self):
11 13
         res = self.testapp.get('/api/v2/sessions/logout', status=204)
12 14
 
13 15
 
14 16
 class TestLoginEndpoint(FunctionalTest):
15 17
 
16
-    def test_login_ok(self):
18
+    def test_api__try_login_enpoint__ok_204__nominal_case(self):
17 19
         params = {
18 20
             'email': 'admin@admin.admin',
19 21
             'password': 'admin@admin.admin',
@@ -24,7 +26,7 @@ class TestLoginEndpoint(FunctionalTest):
24 26
             status=204,
25 27
         )
26 28
 
27
-    def test_bad_password(self):
29
+    def test_api__try_login_enpoint__err_400__bad_password(self):
28 30
         params = {
29 31
             'email': 'admin@admin.admin',
30 32
             'password': 'bad_password',
@@ -35,7 +37,7 @@ class TestLoginEndpoint(FunctionalTest):
35 37
             params=params,
36 38
         )
37 39
 
38
-    def test_bad_user(self):
40
+    def test_api__try_login_enpoint__err_400__unregistered_user(self):
39 41
         params = {
40 42
             'email': 'unknown_user@unknown.unknown',
41 43
             'password': 'bad_password',
@@ -46,13 +48,13 @@ class TestLoginEndpoint(FunctionalTest):
46 48
             params=params,
47 49
         )
48 50
 
49
-    def test_uncomplete(self):
51
+    def test_api__try_login_enpoint__err_400__no_json_body(self):
50 52
         res = self.testapp.post_json('/api/v2/sessions/login', status=400)
51 53
 
52 54
 
53 55
 class TestWhoamiEndpoint(FunctionalTest):
54 56
 
55
-    def test_whoami_ok(self):
57
+    def test_api__try_whoami_enpoint__ok_200__nominal_case(self):
56 58
         self.testapp.authorization = (
57 59
             'Basic',
58 60
             (
@@ -71,7 +73,7 @@ class TestWhoamiEndpoint(FunctionalTest):
71 73
         assert res.json_body['caldav_url'] is None
72 74
         assert res.json_body['avatar_url'] is None
73 75
 
74
-    def test_unauthenticated(self):
76
+    def test_api__try_whoami_enpoint__err_401__unauthenticated(self):
75 77
         self.testapp.authorization = (
76 78
             'Basic',
77 79
             (