Exemplo n.º 1
0
    def test_containsCookiesAfterCreateSession(self):
        client = QcClient(self.username, self.password, self.domain, self.project)
        client.login()
        client.createSession()

        self.assertIn('X-XSRF-TOKEN', client.session.cookies.get_dict().keys())
        self.assertIn('QCSession', client.session.cookies.get_dict().keys())
Exemplo n.º 2
0
Arquivo: main.py Projeto: Anton-Sl/QC
import run
from Restconnector import RestConnector
from qc_client import QcClient
from quality_center_utils import UpdateIterations
import constants
from base_entity import BaseEntity
from MyEntity import *

client = QcClient(username='******', password='******')

client.Login()

print(client.GetEntity(entityType="tests"))
print(client.GetEntity(entityType="tests", entityId=214))
print(client.GetTestById(214))
print(client.GetTestByName('Test1'))
print(client.GetTestSetFolderByName("f1"))
a = {
    u'text-sync': None,
    u'user-01': u'Reviewed',
    u'user-03': u'2-Medium',
    u'vc-start-audit-action-id': u'6864',
    u'ver-stamp': u'53',
    u'has-linkage': u'N',
    u'has-dependencies': u'0',
    u'configurations-count': u'2',
    u'base-test-id': None,
    u'owner': None,
    u'estimate-devtime': None,
    u'id': u'214',
    u'vc-time': None,
Exemplo n.º 3
0
Arquivo: main.py Projeto: boyolya/QC
from qc_client import QcClient
from MyEntity import *
from quality_center.constants import Status
from secureData import SecureData
connector = QcClient(username=SecureData.username,
                     password=SecureData.password)
print("Login = "******"GetEntity = ", connector.GetEntity(entityType="tests", entityId=213))
print("GetFields = ", connector.GetFields(entityType="test-set"))
print("GetMandatoryFields = ", connector.GetMandatoryFields("runs"))

answer = connector.GetTestSetFolderByName("folder_1")
print("GetTestSetFolderByName = ", answer)
print("GetTestSetFoldersByParentId = ",
      connector.GetTestSetFoldersByParentId(answer[0]["parent-id"]))
print("GetTestSetFoldersById = ",
      connector.GetTestSetFoldersById(answer[0]['id']))

test_sets = connector.GetTestSetByParentId(answer[0]['id'])

newTestSetNameI = max([
    int(str(test_set['name']).replace('myTestSet', ''))
    for test_set in test_sets
]) + 1

ts = TestSet("myTestSet" + str(newTestSetNameI))
ts.parentId = answer[0]['id']
answer = connector.CreateTestSet(ts)
print("CreateTestSet = ", answer)
print("GetTestSetById = ", connector.GetTestSetById(answer[0]['id']))
print("GetTestSetByParentId = ",
Exemplo n.º 4
0
    def test_classAsContexManagerExitCorrect(self):
        with self.assertRaises(requests.exceptions.RequestException):
            with QcClient(self.username, self.password, self.domain, self.project) as client:
                pass

            client.getEntity('tests')
Exemplo n.º 5
0
 def test_classAsContextManagerWithCorrectData(self):
     with QcClient(self.username, self.password, self.domain, self.project) as client:
         client.createSession()
         self.assertIsInstance(client.getEntity('tests'), list)
Exemplo n.º 6
0
 def test_getEntityWithoutLoginAndSession(self):
     client = QcClient(self.username, self.password, self.domain, self.project)
     with self.assertRaises(requests.HTTPError):
         self.assertRaises(client.getEntity('tests'))
Exemplo n.º 7
0
 def test_getEntityWithIncorrectData(self):
     client = QcClient(self.username, self.password, self.domain, self.project)
     client.login()
     client.createSession()
     with self.assertRaises(ValueError):
         client.getEntity('entity')
Exemplo n.º 8
0
 def test_getEntityWithCorrectData(self):
     client = QcClient(self.username, self.password, self.domain, self.project)
     client.login()
     client.createSession()
     self.assertIsInstance(client.getEntity('tests'), list)
Exemplo n.º 9
0
 def test_createSessionWithoutLogin(self):
     client = QcClient(self.username, self.password, self.domain, self.project)
     self.assertFalse(client.createSession())
Exemplo n.º 10
0
 def test_loginAfterLogin(self):
     client = QcClient(self.username, self.password, self.domain, self.project)
     client.login()
     self.assertTrue(client.login())
Exemplo n.º 11
0
 def test_containsCookieAfterLogin(self):
     client = QcClient(self.username, self.password, self.domain, self.project)
     client.login()
     self.assertIn('LWSSO_COOKIE_KEY', client.session.cookies.get_dict().keys())
Exemplo n.º 12
0
 def test_loginWithIncorrectData(self):
     client = QcClient('test', 'test', self.domain, self.project)
     self.assertFalse(client.login())
Exemplo n.º 13
0
 def test_loginWithCorrectData(self):
     client = QcClient(self.username, self.password, self.domain, self.project)
     self.assertTrue(client.login())
Exemplo n.º 14
0
 def test_logout(self):
     client = QcClient(self.username, self.password, self.domain, self.project)
     client.login()
     client.logout()
     self.assertNotEqual(True, client.isAuthenticated())
Exemplo n.º 15
0
 def test_isAuthenticatedWhenAuthenticated(self):
     client = QcClient(self.username, self.password, self.domain, self.project)
     client.login()
     self.assertTrue(client.isAuthenticated())
Exemplo n.º 16
0
 def test_isAuthenticatedWhenNotAuthenticated(self):
     client = QcClient(self.username, self.password, self.domain, self.project)
     self.assertNotEqual(True, client.isAuthenticated())