Creating test cases - GET microservice - unit-testing

Need help with this scenario
I want to create all the possible test cases to test the following GET microservice, which receives:
In the request the date of the current day in DD-MM-YYYY format.
Two headers, the first is "Country", whose domain of values can be "USA" or "Canada" and the second is "City", whose domain of values is "Santiago","Arica", "Chiloe" (when it is Country USA) and "Toronto", "SanJuan" (when country is Canada)
When the result is positive, it returns status ok and http code 200 and in case of error the status is "client error" and in case of error connection the status is "server error" and in the case of the code for each of these statuses, the standard error http codes are delivered.
Consider that when it is a Country other than those indicated or a different city, the response "Wrong Country and City", and that all the fields to enter are Sensitive Case.
The microservice response returns the CurrentTemperature and NextDayTemperature in json format.

Related

Changing measures with a slicer: "a table of multiple values was supplied where a single value was expected" error message

I followed this blog's instructions to create a slicer that would let me swap between measures in a text table: https://community.powerbi.com/t5/Community-Blog/Dynamically-change-the-information-within-a-visual-via-a-slicer/ba-p/87027
I am getting this error message for the column I am creating in the last step: "a table of multiple values was supplied where a single value was expected":
Select level (% favorable) =
SWITCH( TRUE(),
VALUES ('Measure Dimensions'[Measure]) = "Country", ROUND([c_pct_favorable],1),
VALUES ('Measure Dimensions'[Measure]) = "State", ROUND([s_pct_favorable],1),
VALUES ('Measure Dimensions'[Measure]) = "Zip", ROUND([z_pct_favorable],1),
BLANK())
I am basically trying to swap between country, state, and zip code level % favorable survey data.
Note: I had to add the ROUND calculation because I was getting a 'you can't combine fields with different data types' error message.
I tried Googling this error message but didn't find a use case exactly like mine and couldn't figure out the other article's logic and how it applied to my problem.
Thank you very much for your help!

Generating a barcode in SSRS/Microsoft Report Builder with an iif statement as one barcode is coming from a database and then on being a basic barcode

I am currently generating a barcode for shipment ID parameter
Code: =Datex.Foundation.Reporting.Barcodes.BarcodeGenerator.GetImageBytes(Datex.Foundation.Reporting.Barcodes.SymbologyEnum.Code128,Fields!shipmentLookupCode.Value, 500, 100, 2, Datex.Foundation.Reporting.Barcodes.HorizontalAlignment.Center)Parameters!
I have a free text parameter for a C-Trac Ref #, that I need to have a create a basic barcode when the shipment id is NULL. The C-Trac Ref # is not coming for the database like the shipment id is.

AWS Athena: Large Case Statement Internal Error

I've got a very simple select query running and working in amazon athena:
SELECT
campaign
FROM table;
However, we've got some data consistency issues and campaign is sometimes and ID and sometimes a name, so we've got to map the values so its all ids.
To do this I added a large case statement which looks something like this
SELECT
CASE WHEN account = 'something' AND campaign = 'some name' THEN 'some id'
CASE WHEN account = 'something' AND campaign = 'some other name' THEN 'some other id'
ELSE campaign END as campaign_id
FROM table;
Except instead of only 2 case statements, theres 2400 of them.
When I run the query it spins for a second and I get an "Internal Error" and thats it.

Querying embedded documents by matching dates in MongoDB

I have a database containing emails and I want to search for a specific date using the regex operator and return all emails sent on that date. I have tried this so far but it doesn't return anything. I am new to regex and am not sure if I'm querying the date correctly.
db.messages.find({'headers.Date' : $regex : '2001-07-06'}})
This example below successfully returned all the emails send from the specified email address.
db.messages.find({'headers.From' : { $regex : 'reservations#merriotts.com' } });
The emails contain the following information:
headers { content transfer encoding, content type, date, from, message id, mime version, subject, to }
You need not make use of regex here, something simpler like this should work:
db.posts.find({"headers.Date": new Date(2001, 06, 06) })
This should work if the dates you saved in the DB are without time (just day, month, year)
Now if you have dates saved with new Date(), which includes the time components as well, then you need to create a date range which includes all the moments for that day :
db.posts.find( //query for all moments/time of a specific date
{"headers.Date": {"$gte": new Date(2001, 6, 6), "$lt": new Date(2001, 6, 7)}})
Note - The API for Date is Date(YYYY,MM,DD) and counting for 'month' starts from '0' and counting for 'date' starts from '1'.

FQL Limit clause showing greater number of results than it should?

I have a simple query to show a given users photos:
SELECT pid FROM photo_tag WHERE subject in "12345" LIMIT 400,500
It returns 500 results... shouldn't it return 100?
No. Your query is asking for 500 records starting with record 401.
To return the records 400-500 your query should read
SELECT pid FROM photo_tag WHERE subject in "12345" LIMIT 400, 100