There are different types of Asserts in Postman. We can add Assertions on different sections of the Response received. Some of the Assert types are listed below −Assert on Response Codepm.test["Status Code is 200"], function(){ pm.response.to.have.status(200) })The above assertion passes if the Response code is 200.pm.test["Status is OK"], function(){ pm.response.to.have.property('status', ' OK') })The above assertion is applied on the Response property – status with value as OK.Assert on Response timepm.test("Response time below 600 milliseconds", function () { pm.expect(pm.response.responseTime).to.be.below(600) })The above assertion passes if the Response time is below 600ms.Assert on Response Formatpm.test("Response is of JSON type ", ... Read More
To show the Logarithmic plot of a cumulative distribution function in Matplotlib, we can take the following steps.StepsSet the figure size and adjust the padding between and around the subplots.Initialize a variable, N, for number of sample data.Create data, X2 and F2 using numpy.Plot X2 and F2 using plot() method.Make x and y scale logarithmic.To display the figure, use show() method.Exampleimport numpy as np import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True N = 100 data = np.random.randn(N) X2 = np.sort(data) F2 = np.array(range(N))/float(N) plt.plot(X2, F2) plt.xscale('log') plt.yscale('log') plt.show()OutputRead More
To visualize scalar 2D data with matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Initialize a variable, N, for data samples.Create x and y data points using numpy.Get coordinate matrices from coordinate vectors.Get z data points using numpy.Create a pseudocolor plot with a non-regular rectangular grid.To display the figure, use show() method.Exampleimport numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True n = 256 x = np.linspace(-3., 3., n) y = np.linspace(-3., 3., n) X, Y = np.meshgrid(x, ... Read More
To use pyplot.arrow or patches.Arrow() in matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Initialize four variables, x_tail, y_tail, x_head and y_head.Create a figure and a set of subplots.Get a fancy arrow instance.Add an artist (step 4) using add_patch() method.To display the figure, use show() method.Examplefrom matplotlib import pyplot as plt, patches as mpatches plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x_tail = 0.1 y_tail = 0.1 x_head = 0.9 y_head = 0.9 fig, ax = plt.subplots() arrow = mpatches.FancyArrowPatch((x_tail, y_tail), (x_head, y_head), mutation_scale=100, color='green') ... Read More
We can execute Tests on Cookies in Postman. Once a request gets executed for an endpoint, a Response gets generated. Within a Response, the cookie information gets generated under the Cookies tab.We can add Tests script around cookies and apply Assertions on them for verification. Test scripts are incorporated under the Tests tab. Let us add the below script to verify the value of cookie – Cookie_Postman.pm.test("Verify Cookie value", function(){ pm.expect(pm.cookies.get('Cookie_Postman')).to.eql('value1')})Send the Request. After the Response is received, navigate to the Tests tab. It shows the Assertion in our Test script failed as the expected value of the Cookie_Postman is ... Read More
To add black border to matplotlib 2.0 'ax' object in Python, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Set axes edgecolor to black.Set axes linewidth to 2.50.Initialize a variable, N, to get the number of sample data.Create x and y data points using numpy.Plot x and y data points using plot() method.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True plt.rcParams["axes.edgecolor"] = "black" plt.rcParams["axes.linewidth"] = 2.50 N = 10 x = np.random.randint(low=0, high=N, size=N) y ... Read More
We can create a Mock Server in Postman. A Mock Server is used to simulate the working of an actual server to test APIs and Responses. These are very common if certain APIs require to be tested but they are presently unavailable on the web servers due to security concerns on the real server.The steps to create a Mock Server are listed below -Step 1 − Click on New from the top of the Postman application. Then click on the Mock Server link.Step 2 − Choose the option GET from the Method field, add a Request Path as /user/home, enter ... Read More
To adjust tick frequency for for Y-axis, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Initialize a variable, N, for number of sample data points.Create x and y data points using numpy.Plot x and y data points using plot() method.Initialize a variable freq_y to adjust the frequency of the yticks.Use yticks() method to set the yticks.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt import numpy as np plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True N = 10 x = np.random.randint(low=0, high=N, size=N) y = np.random.randint(low=0, high=N, ... Read More
To plot a 3D patch collection in matplotlib, we can take the following steps −Set the figure size and adjust the padding between and around the subplots.Create a new figure or activate an existing figure.Get the current axes and set projection as 3d.Iterate ["x", "y", "z"] list, and set the circle patch using pathpatch_2d_to_3d() method to convert a PathPatch to a PathPatch3D object.To display the figure, use show() method.Exampleimport matplotlib.pyplot as plt from matplotlib.patches import Circle import mpl_toolkits.mplot3d.art3d as art3d plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True fig = plt.figure() ax = fig.gca(projection='3d') for i in ["x", ... Read More
In Postman, sometimes we need to verify the eligibility of a user accessing a particular resource on the server. This is done by authenticating the credentials of a user by the system.Thus authentication helps to identify the identity of a user and is applied for the secured APIs. In Postman, this is carried out under the Authorization tab. The TYPE dropdown in the Authorization tab, lists down all the Authorization types.To carry out an encoded authentication, we have to choose the option No Auth from the TYPE dropdown in the Authorization tab and simultaneously from the Headers tab, we have ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP