Exemplo n.º 1
0
    def auth(self):
        auTest = AuthenticationTest.AuthenticationTest()
        authentication = Authentication()

        ag = authentication.getAuthToken(Constant().clientInfo())

        # print("====== get access token ======")
        # print("result:", ag + "\n")
        return ag
 def refreshAuthTokenInfo(self):
     arInDTO = AuthRefreshInDTO()
     arInDTO.appId = (Constant().readConfFile())[2]
     arInDTO.secret = (Constant().readConfFile())[3]
     authOutDTO = AuthOutDTO()
     result = Authentication().getAuthToken(Constant().clientInfo())
     authOutDTO.setRefreshToken(json.loads(result)['refreshToken'])
     arInDTO.refreshToken = authOutDTO.getRefreshToken()
     return arInDTO
Exemplo n.º 3
0
    def refresh_auth(self):
        auTest = AuthenticationTest.AuthenticationTest()
        authentication = Authentication()

        # ag = authentication.getAuthToken(Constant().clientInfo())

        # print("====== get access token ======")
        # print("result:", ag + "\n")
        ar = authentication.refreshAuthToken(auTest.refreshAuthTokenInfo())
        # print("====== refresh token ======")
        # print("result:", ar + "\n")
        return ar
Exemplo n.º 4
0
        qddhInDTO.deviceId = "bd6394ed-b41d-430d-85f8-5d0290cfee24"
        qddhInDTO.gatewayId = "bd6394ed-b41d-430d-85f8-5d0290cfee24"
        qddhInDTO.appId = "wk14orhpOumkAouraCpOsoQ3iO4a"
        return qddhInDTO

    def queryDeviceCapabilities(self):
        qdcInDTO = QueryDeviceCapabilitiesInDTO()
        qdcInDTO.deviceId = "bd6394ed-b41d-430d-85f8-5d0290cfee24"
        qdcInDTO.gatewayId = "bd6394ed-b41d-430d-85f8-5d0290cfee24"
        qdcInDTO.appId = "wk14orhpOumkAouraCpOsoQ3iO4a"
        return qdcInDTO


if __name__ == "__main__":
    dcTest = DataCollectionTest()
    authentication = Authentication()
    dataCollection = DataCollection()

    # get accessToken at first
    result = authentication.getAuthToken(Constant().clientInfo())
    authOutDTO = AuthOutDTO()
    authOutDTO.setAccessToken(json.loads(result)['accessToken'])
    accessToken = authOutDTO.getAccessToken()

    # query device info
    deviceId = "782eb286-9ead-424f-a910-c235b6090edc"
    dq = dataCollection.querySingleDeviceInfo(deviceId, None, None,
                                              accessToken)
    print("====== query device info ======")
    print("result:", dq + "\n")
            mdsInDTO.serviceDesireds.serviceId: "Discovery",
            mdsInDTO.serviceDesireds.desired: {}
        }]
        return mdsInDTO

    def refreshDeviceKeyInfo(self):
        rdkInDTO = RefreshDeviceKeyInDTO()
        rdkInDTO.deviceId = deviceId
        rdkInDTO.nodeId = "SSSDAWSQAS"
        rdkInDTO.verifyCode = "SSSDAWSQAS11"
        return rdkInDTO


if __name__ == "__main__":
    dmTest = DeviceManagementTest()
    authentication = Authentication()
    deviceManagement = DeviceManagement()

    # get accessToken at first
    result = Authentication().getAuthToken(Constant().clientInfo())
    authOutDTO = AuthOutDTO()
    authOutDTO.setAccessToken(json.loads(result)['accessToken'])
    accessToken = authOutDTO.getAccessToken()

    # register a new device
    dr = deviceManagement.regDirectDevice(dmTest.regDirectDeviceInfo(), None,
                                          accessToken)
    print("====== register a new device ======")
    print("result:", dr + "\n")

    # get deviceId