Example #1
0
import unittest
import requests

from GetAuthToken import getToken
import json
from settings import mongodb, unittest_test_url
from DBUtil import Sync, Versions
import verifyResponse

Syncdb = Sync.Sync(mongodb)
Baseurl = unittest_test_url + "sync/"
header = {'content-type': "application/json", 'token': str(getToken())}


class SyncViewAllTest(unittest.TestCase):
    sync_id = None

    def runTest(self):
        url = Baseurl + "view/all"
        print "--------------------------------------------------------------------------------------------------------"
        print "Calling API :" + url + " For Sync view all test"
        response = requests.request("GET", url, headers=header, verify=False)
        verifyResponse.PositiveTesting(response)
        json_data = json.loads(response.text)
        data = json_data.get("data").get("data")
        rec = data[0]
        SyncViewAllTest.sync_id = rec.get("sync_id")


class GetBySyncIdTest(unittest.TestCase):
    def runTest(self):
Example #2
0
import requests

from GetAuthToken import getToken
import json
from settings import mongodb,unittest_test_url
from DBUtil import MachineGroups,Accounts,Users,MachineType,Machine
import verifyResponse

UsersDb=Users.Users(mongodb)
AccountsDb=Accounts.Accounts()
MachineDb=Machine.Machine(mongodb)
MachineTypeDb=MachineType.MachineType(mongodb)
MachineGroupdb=MachineGroups.MachineGroups(mongodb)
Baseurl = unittest_test_url+"machinegroups/"
header = {'content-type': "application/json",
                   'token':str(getToken())}
class AddMachineGroupTest(unittest.TestCase):
    oid=None;
    MacOid1=None;
    MacOid2=None
    def runTest(self):
        CreateMachinesForMachineGroup()
        url=Baseurl+"add"
        print "--------------------------------------------------------------------------------------------------------"
        print "Calling API :"+url + " For Create MachineGroup test"
        payload={"group_name":"UnitTestMachineGroup",
                 "machine_id_list":[AddMachineGroupTest.MacOid1,
                                    AddMachineGroupTest.MacOid2]}
        response = requests.request("POST", url, data=json.dumps(payload), headers=header,verify=False)
        verifyResponse.PositiveTesting(response)
        json_data = json.loads(response.text)