def test_logout(self): with patch.object(requests, 'post') as mocked_login: mocked_login.return_value = Mock(status_code=200) mocked_login.return_value.json.return_value = fakeToken login('organicfrog305', 'gilles') with patch.object(requests, 'post') as mocked_post: mocked_post.return_value = Mock(status_code=200) mocked_post.return_value.json.return_value = fakeToken self.assertEqual(logout(), 404)
def test_healthcheck(self): with patch.object(requests, 'post') as mocked_login: mocked_login.return_value = Mock(status_code=200) mocked_login.return_value.json.return_value = fakeToken login('organicfrog305', 'gilles') with patch.object(requests, 'get') as mocked_get: mocked_get.return_value = Mock(status_code=200) mocked_get.return_value.json.return_value = myStatus self.assertEqual(healthcheck(), 200) with patch.object(requests, 'post') as mocked_logout: mocked_logout.return_value = Mock(status_code=200) mocked_logout.return_value.json.return_value = fakeToken logout()
def test_admin_actions_invalid_combination2(self): with patch.object(requests, 'post') as mocked_login: mocked_login.return_value = Mock(status_code=200) mocked_login.return_value.json.return_value = fakeToken login('organicfrog305', 'gilles') with patch.object(requests, 'post') as mocked_post: mocked_post.return_value = Mock(status_code=404) mocked_post.return_value.json.return_value = fakeToken self.assertEqual(admin_actions(usermod=' ', passw='maker'), 404) with patch.object(requests, 'post') as mocked_logout: mocked_logout.return_value = Mock(status_code=200) mocked_logout.return_value.json.return_value = fakeToken logout()
def test_admin_actions_users(self): with patch.object(requests, 'post') as mocked_login: mocked_login.return_value = Mock(status_code=200) mocked_login.return_value.json.return_value = fakeToken login('organicfrog305', 'gilles') with patch.object(requests, 'get') as mocked_get: mocked_get.return_value = Mock(status_code=200) mocked_get.return_value.json.return_value = fakeToken self.assertEqual(admin_actions(users='browntiger776'), [200, 0]) with patch.object(requests, 'post') as mocked_logout: mocked_logout.return_value = Mock(status_code=200) mocked_logout.return_value.json.return_value = fakeToken logout()
def test_sessions_per_provider(self): with patch.object(requests, 'post') as mocked_login: mocked_login.return_value = Mock(status_code=200) mocked_login.return_value.json.return_value = fakeToken login('organicfrog305', 'gilles') with patch.object(requests, 'get') as mocked_get: mocked_get.return_value = Mock(status_code=200) mocked_get.return_value.json.return_value = 0 self.assertEqual(sessions_per_station('1', '20080202', '20201010'), 200) with patch.object(requests, 'post') as mocked_logout: mocked_logout.return_value = Mock(status_code=200) mocked_logout.return_value.json.return_value = fakeToken logout()
def test_sessions_per_ev(self): with patch.object(requests, 'post') as mocked_login: mocked_login.return_value = Mock(status_code=200) mocked_login.return_value.json.return_value = fakeToken login('organicfrog305', 'gilles') with patch.object(requests, 'get') as mocked_get: mocked_get.return_value = Mock(status_code=200) mocked_get.return_value.json.return_value = 0 self.assertEqual( sessions_per_station('059c028d-b2a6-4a8d-947a-158c7537b290', '20080202', '20201010'), 200) with patch.object(requests, 'post') as mocked_logout: mocked_logout.return_value = Mock(status_code=200) mocked_logout.return_value.json.return_value = fakeToken logout()
def test_admin_actions_invalid_combination3(self): with patch.object(requests, 'post') as mocked_login: mocked_login.return_value = Mock(status_code=200) mocked_login.return_value.json.return_value = fakeToken login('organicfrog305', 'gilles') with patch.object(requests, 'post') as mocked_post: mocked_post.return_value = Mock(status_code=404) mocked_post.return_value.json.return_value = fakeToken self.assertEqual( admin_actions(username='******', sessionsupd='source'), 404) with patch.object(requests, 'post') as mocked_logout: mocked_logout.return_value = Mock(status_code=200) mocked_logout.return_value.json.return_value = fakeToken logout()