예제 #1
0
  def test_URLParamsGoToServer(self):
    if containerTestCommon.runningViaKong:
      print("Skipping test_testNormalJWTHeader as this won't work via Kong - Kong can not read custom headers")
      return

    #https://api.metcarob.com/saas_user_management/v0/authed/api/admin/usersystem/users?query=code&pagesize=100&offset=0
    loginDICT = containerTestCommon.getLoginDICTForDefaultUser(self)
    jwtToken = loginDICT['jwtData']['JWTToken']
    headers = {}
    cookies = {constants.jwtCookieName: jwtToken}
    res, _ = callGetService(
      containerTestCommon.ADMIN,
      "/" + constants.masterTenantName + "/users",
      [200],
      None,
      headers,
      cookies
    )
    self.assertNotEqual(len(res['result']), 0, msg="Should not have zero users")
    res2, _ = callGetService(
      containerTestCommon.ADMIN,
      "/" + constants.masterTenantName + "/users?query=codedfskhdsgew43tgrsadsasd&pagesize=100&offset=0&someotherparam=abs",
      [200],
      None,
      headers,
      cookies
    )
    print(res2)
    self.assertEqual(len(res2['result']), 0, msg="Query paramater should have resulted in no results")
예제 #2
0
    def testPOSTWithoutOriginFails(self):
        AuthProvidersDICT, res = callGetService(
            LOGIN, "/" + constants.masterTenantName + "/authproviders", [200],
            None, None, None)
        MainAuthProvider = AuthProvidersDICT['AuthProviders'][0]

        loginCallDICT = {
            "authProviderGUID": MainAuthProvider['guid'],
            "credentialJSON": {
                "username":
                getEnviromentVariable('APIAPP_DEFAULTHOMEADMINUSERNAME'),
                "password":
                getHashedPasswordUsingSameMethodAsJavascriptFrontendShouldUse(
                    getEnviromentVariable('APIAPP_DEFAULTHOMEADMINUSERNAME'),
                    getEnviromentVariable('APIAPP_DEFAULTHOMEADMINPASSWORD'),
                    MainAuthProvider['saltForPasswordHashing'])
            }
        }
        ###print("Login DICT:",loginCallDICT)
        loginDICT, res = callPostService(LOGIN,
                                         "/" + constants.masterTenantName +
                                         "/authproviders",
                                         loginCallDICT, [401],
                                         None,
                                         None,
                                         None,
                                         addOrigin=False)
        self.assertEqual(loginDICT["message"],
                         "Invalid Origin",
                         msg="Wrong error message returned")
예제 #3
0
 def testGetWithoutOriginPasses(self):
     AuthProvidersDICT, res = callGetService(
         LOGIN,
         "/" + constants.masterTenantName + "/authproviders", [200],
         None,
         None,
         None,
         addOrigin=False)
예제 #4
0
 def test_testNormalJWTCookie(self):
   if containerTestCommon.runningViaKong:
     print("Skipping test_testNormalJWTHeader as this won't work via Kong - Kong can not read custom headers")
     return
   loginDICT = containerTestCommon.getLoginDICTForDefaultUser(self)
   jwtToken = loginDICT['jwtData']['JWTToken']
   
   headers = {}
   cookies = {constants.jwtCookieName: jwtToken}
   tenantDICT, call_result = containerTestCommon.callGetService(containerTestCommon.ADMIN,"/" + constants.masterTenantName + containerTestCommon.securityTestAPIEndpoint, [200], None, headers, cookies)
예제 #5
0
 def test_frontendMainPage(self):
   callGetService(containerTestCommon.FRONTEND, "/", [200], None, None, None) #This gives us Quasar 404 page but still a 200 response
   callGetService(containerTestCommon.FRONTEND, "/#/usersystem/", [200], None, None, None)
예제 #6
0
 def test_adminfrontendMainPage(self):
   callGetService(containerTestCommon.ADMINFRONTEND, "/", [200], None, None, None)
   callGetService(containerTestCommon.ADMINFRONTEND, "/#/usersystem/", [200], None, None, None)
예제 #7
0
 def test_WeCanGetToSwaggerUIStaticFiles(self):
   callGetService(containerTestCommon.APIDOCS, "/swaggerui/bower/swagger-ui/dist/droid-sans.css", [200], None, None, None)
예제 #8
0
 def test_ContainerVersionMatchesEnviromentVariable(self):
   self.assertTrue('EXPECTED_CONTAINER_VERSION' in os.environ, msg="EXPECTED_CONTAINER_VERSION missing from enviroment")
   resultJSON, status = callGetService(containerTestCommon.SERVERINFO, "/serverinfo", [200], None, None, None)
   print(resultJSON)
   self.assertEqual(resultJSON['Server']['Version'], os.environ['EXPECTED_CONTAINER_VERSION'])
예제 #9
0
 def test_WeCanGetToAPIDocsURL(self):
   callGetService(containerTestCommon.APIDOCS, "/", [200], None, None, None)
예제 #10
0
 def test_WeCanGetToSwaggerFileForAPIDocs(self):
   callGetService(containerTestCommon.APIDOCS, "/swagger.json", [200], None, None, None)