Skip to content

raggiadolf/veftassignment08apitester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Setup Assuming you have the pip package manager for python, run 'pip install -r requirements.txt', this installs the 'requests' dependency for python needed to send the requests to the api.

The tester assumes that the database is empty(Use db.dropDatabase() in the mongo shell to empty a database), that there is at least one entry in the users document with a token, and that the api is running on localhost.

#Run Example(assuming admin_token is 'admintoken', portnumber is 4000):

In the mongo shell, drop the database and insert a document in to the users collection with a {token : test}:

db.dropDatabase()
db.users.insert({'token' : 'test'})

In the terminal, run testapi with the corresponding parameters:

python testapi.py 4000 admintoken test

First parameter(4000) is the port the server is listening on

Second parameter(admintoken) is the ADMIN_TOKEN hardcoded into the api

Third parameter(test) is the token of a user in the databse

##Easy mode Run Use 'sh testscript.sh portno admintoken', where portno is the port the api is listening on and admintoken is the hardcoded ADMIN_TOKEN. (You might need to 'chmod -x testscript.sh' to make it executable).

This handles dropping the database, inserting a user with token 'test' and then starting the tester with the correct parameters.

About

A simple tester for assignment08 in T-514-VEFT

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •