forked from pyapi-gitlab/pyapi-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
40 lines (34 loc) · 1.15 KB
/
__init__.py
File metadata and controls
40 lines (34 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import responses
from gitlab_tests.base_test import BaseTest
from response_data.common import *
from response_data.users import *
class TestLogin(BaseTest):
@responses.activate
def test_login(self):
responses.add(
responses.POST,
self.gitlab.api_url + '/session',
json=login,
status=201,
content_type='application/json')
self.assertEqual(
login, self.gitlab.login(user=self.user, password=self.password))
@responses.activate
def test_login_email(self):
responses.add(
responses.POST,
self.gitlab.api_url + '/session',
json=login,
status=201,
content_type='application/json')
self.assertEqual(
login, self.gitlab.login(email='admin@example.com', password='test'))
@responses.activate
def test_login_with_no_values(self):
responses.add(
responses.POST,
self.gitlab.api_url + '/session',
body=get_users,
status=404,
content_type='application/json')
self.assertRaises(ValueError, self.gitlab.login)