Ver código fonte

Better api test naming

Guénaël Muller 7 anos atrás
pai
commit
2ecf59588e

+ 3 - 3
tracim/tests/functional/test_doc.py Ver arquivo

3
 
3
 
4
 class TestDoc(FunctionalTest):
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
         res = self.testapp.get('/api/v2/doc/', status=200)
7
         res = self.testapp.get('/api/v2/doc/', status=200)
8
         assert res.content_type == 'text/html'
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
         res = self.testapp.get('/api/v2/doc/spec.yml', status=200)
11
         res = self.testapp.get('/api/v2/doc/spec.yml', status=200)
12
         assert res.content_type == 'text/x-yaml'
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
         res = self.testapp.get(
15
         res = self.testapp.get(
16
             '/api/v2/doc/favicon-32x32.png',
16
             '/api/v2/doc/favicon-32x32.png',
17
             status=200,
17
             status=200,

+ 9 - 7
tracim/tests/functional/test_session.py Ver arquivo

6
 
6
 
7
 class TestLogoutEndpoint(FunctionalTest):
7
 class TestLogoutEndpoint(FunctionalTest):
8
 
8
 
9
-    def test_logout(self):
9
+    def test_api__access_logout_get_enpoint__ok__nominal_case(self):
10
         res = self.testapp.post_json('/api/v2/sessions/logout', status=204)
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
         res = self.testapp.get('/api/v2/sessions/logout', status=204)
13
         res = self.testapp.get('/api/v2/sessions/logout', status=204)
12
 
14
 
13
 
15
 
14
 class TestLoginEndpoint(FunctionalTest):
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
         params = {
19
         params = {
18
             'email': 'admin@admin.admin',
20
             'email': 'admin@admin.admin',
19
             'password': 'admin@admin.admin',
21
             'password': 'admin@admin.admin',
24
             status=204,
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
         params = {
30
         params = {
29
             'email': 'admin@admin.admin',
31
             'email': 'admin@admin.admin',
30
             'password': 'bad_password',
32
             'password': 'bad_password',
35
             params=params,
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
         params = {
41
         params = {
40
             'email': 'unknown_user@unknown.unknown',
42
             'email': 'unknown_user@unknown.unknown',
41
             'password': 'bad_password',
43
             'password': 'bad_password',
46
             params=params,
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
         res = self.testapp.post_json('/api/v2/sessions/login', status=400)
52
         res = self.testapp.post_json('/api/v2/sessions/login', status=400)
51
 
53
 
52
 
54
 
53
 class TestWhoamiEndpoint(FunctionalTest):
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
         self.testapp.authorization = (
58
         self.testapp.authorization = (
57
             'Basic',
59
             'Basic',
58
             (
60
             (
71
         assert res.json_body['caldav_url'] is None
73
         assert res.json_body['caldav_url'] is None
72
         assert res.json_body['avatar_url'] is None
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
         self.testapp.authorization = (
77
         self.testapp.authorization = (
76
             'Basic',
78
             'Basic',
77
             (
79
             (