Skip to content

Commit e12d1f4

Browse files
fix(repo): dockerfile referenced old CLI version
1 parent 3d24e4b commit e12d1f4

4 files changed

Lines changed: 255 additions & 5 deletions

File tree

Dockerfile.debian

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
FROM debian:12-slim
2+
ARG VERSION=0.8.1
23
RUN apt update && apt install -y curl libicu-dev
34

45
RUN if [ "$(uname -m)" = "aarch64" ]; then \
@@ -9,7 +10,7 @@ RUN if [ "$(uname -m)" = "aarch64" ]; then \
910
echo unsupported arch "$(uname -m)"; \
1011
exit 1; \
1112
fi && \
12-
curl -LO https://github.com/smartbear-devrel/explore-cli/releases/download/0.6.0/explore-cli-linux-$BINARY_ARCH.gz && \
13+
curl -LO https://github.com/smartbear-devrel/explore-cli/releases/download/${VERSION}/explore-cli-linux-$BINARY_ARCH.gz && \
1314
gunzip explore-cli-linux-$BINARY_ARCH.gz && \
1415
chmod +x explore-cli-linux-$BINARY_ARCH && \
1516
mv explore-cli-linux-$BINARY_ARCH /usr/local/bin/explore-cli && \

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,13 @@ Dockerfiles are provided for amd64 & arm64 flavours
8888

8989
##### Building images
9090

91+
You can build the Docker images with a specific Explore.CLI version by passing the `VERSION` build argument. If the `VERSION` argument is not provided, the default value specified in the Dockerfile will be used.
92+
9193
```sh
92-
docker build . --platform=linux/arm64 -f Dockerfile.debian -t explore-cli:debian-arm64
93-
docker build . --platform=linux/arm64 -f Dockerfile.debian -t explore-cli:debian-amd64
94-
docker build . --platform=linux/arm64 -f Dockerfile.alpine -t explore-cli:alpine-arm64
95-
docker build . --platform=linux/arm64 -f Dockerfile.alpine -t explore-cli:alpine-amd64
94+
docker build . --platform=linux/arm64 -f Dockerfile.debian -t explore-cli:debian-arm64 --build-arg VERSION=<VERSION>
95+
docker build . --platform=linux/arm64 -f Dockerfile.debian -t explore-cli:debian-amd64 --build-arg VERSION=<VERSION>
96+
docker build . --platform=linux/arm64 -f Dockerfile.alpine -t explore-cli:alpine-arm64 --build-arg VERSION=<VERSION>
97+
docker build . --platform=linux/arm64 -f Dockerfile.alpine -t explore-cli:alpine-amd64 --build-arg VERSION=<VERSION>
9698
```
9799

98100
##### Using images

test/Explore.Cli.Tests/PostmanCollectionMappingHelperTests.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,39 @@ public void ProcessNestedCollections_ShouldReturnTwoStagedAPIs()
143143
Assert.Equal(2, result.Count);
144144
}
145145

146+
[Fact]
147+
public void ProcessesLongDescriptions()
148+
{
149+
// Arrange
150+
var filePath = "../../../fixtures/API_.descriptions_postman_collection.json";
151+
var mockCollectionAsJson = File.ReadAllText(filePath);
152+
var postmanCollection = JsonSerializer.Deserialize<PostmanCollection>(mockCollectionAsJson);
153+
// Act
154+
Assert.Equal("Get data", postmanCollection?.Item?[0].Name);
155+
Assert.Equal("GET", postmanCollection?.Item?[0].Request?.Method?.ToString());
156+
Assert.Equal("This is a GET request and it is used to \"get\" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have `id=1`).\n\nA successful GET response will have a `200 OK` status, and should include some kind of response body - for example, HTML web content or JSON data.", postmanCollection?.Item?[0].Request?.Description?.Content?.ToString());
157+
}
158+
159+
[Fact]
160+
public void ProcessNestedCollections_ShouldParseDescriptions()
161+
{
162+
// Arrange
163+
var filePath = "../../../fixtures/API_.descriptions_postman_collection.json";
164+
var mockCollectionAsJson = File.ReadAllText(filePath);
165+
var postmanCollection = JsonSerializer.Deserialize<PostmanCollection>(mockCollectionAsJson);
166+
167+
// Act
168+
List<StagedAPI> result = new List<StagedAPI>();
169+
if (postmanCollection != null)
170+
{
171+
result = PostmanCollectionMappingHelper.MapPostmanCollectionToStagedAPI(postmanCollection, "REST API");
172+
}
173+
// Assert
174+
Assert.NotNull(result);
175+
Assert.IsType<List<StagedAPI>>(result);
176+
Assert.Single(result.Count);
177+
}
178+
146179
[Fact]
147180
public void ProcessNestedCollections_ShouldReturnMultipleStagedAPIs()
148181
{
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
{
2+
"info": {
3+
"_postman_id": "124200c9-7ad3-44b2-9036-e73ab91aa95d",
4+
"name": "REST API basics: CRUD, test & variable",
5+
"description": "# 🚀 Get started here\n\nThis template guides you through CRUD operations (GET, POST, PUT, DELETE), variables, and tests.\n\n## 🔖 **How to use this template**\n\n#### **Step 1: Send requests**\n\nRESTful APIs allow you to perform CRUD operations using the POST, GET, PUT, and DELETE HTTP methods.\n\nThis collection contains each of these [request](https://learning.postman.com/docs/sending-requests/requests/) types. Open each request and click \"Send\" to see what happens.\n\n#### **Step 2: View responses**\n\nObserve the response tab for status code (200 OK), response time, and size.\n\n#### **Step 3: Send new Body data**\n\nUpdate or add new data in \"Body\" in the POST request. Typically, Body data is also used in PUT request.\n\n```\n{\n \"name\": \"Add your name in the body\"\n}\n\n ```\n\n#### **Step 4: Update the variable**\n\nVariables enable you to store and reuse values in Postman. We have created a [variable](https://learning.postman.com/docs/sending-requests/variables/) called `base_url` with the sample request [https://postman-api-learner.glitch.me](https://postman-api-learner.glitch.me). Replace it with your API endpoint to customize this collection.\n\n#### **Step 5: Add tests in the \"Scripts\" tab**\n\nAdding tests to your requests can help you confirm that your API is working as expected. You can write test scripts in JavaScript and view the output in the \"Test Results\" tab.\n\n<img src=\"https://content.pstmn.io/fa30ea0a-373d-4545-a668-e7b283cca343/aW1hZ2UucG5n\" alt=\"\" height=\"1530\" width=\"2162\">\n\n## 💪 Pro tips\n\n- Use folders to group related requests and organize the collection.\n \n- Add more [scripts](https://learning.postman.com/docs/writing-scripts/intro-to-scripts/) to verify if the API works as expected and execute workflows.\n \n\n## 💡Related templates\n\n[API testing basics](https://go.postman.co/redirect/workspace?type=personal&collectionTemplateId=e9a37a28-055b-49cd-8c7e-97494a21eb54&sourceTemplateId=ddb19591-3097-41cf-82af-c84273e56719) \n[API documentation](https://go.postman.co/redirect/workspace?type=personal&collectionTemplateId=e9c28f47-1253-44af-a2f3-20dce4da1f18&sourceTemplateId=ddb19591-3097-41cf-82af-c84273e56719) \n[Authorization methods](https://go.postman.co/redirect/workspace?type=personal&collectionTemplateId=31a9a6ed-4cdf-4ced-984c-d12c9aec1c27&sourceTemplateId=ddb19591-3097-41cf-82af-c84273e56719)",
6+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
7+
"_exporter_id": "23875056",
8+
"_collection_link": "https://explore-sb.postman.co/workspace/Explore~8864586d-215f-47d3-8aa6-8267e45eea4a/collection/23875056-124200c9-7ad3-44b2-9036-e73ab91aa95d?action=share&source=collection_link&creator=23875056"
9+
},
10+
"item": [
11+
{
12+
"name": "Get data",
13+
"event": [
14+
{
15+
"listen": "test",
16+
"script": {
17+
"exec": [
18+
"pm.test(\"Status code is 200\", function () {",
19+
" pm.response.to.have.status(200);",
20+
"});"
21+
],
22+
"type": "text/javascript"
23+
}
24+
}
25+
],
26+
"request": {
27+
"method": "GET",
28+
"header": [],
29+
"url": {
30+
"raw": "{{base_url}}/info?id=1",
31+
"host": [
32+
"{{base_url}}"
33+
],
34+
"path": [
35+
"info"
36+
],
37+
"query": [
38+
{
39+
"key": "id",
40+
"value": "1"
41+
}
42+
]
43+
},
44+
"description": "This is a GET request and it is used to \"get\" data from an endpoint. There is no request body for a GET request, but you can use query parameters to help specify the resource you want data on (e.g., in this request, we have `id=1`).\n\nA successful GET response will have a `200 OK` status, and should include some kind of response body - for example, HTML web content or JSON data."
45+
},
46+
"response": []
47+
},
48+
{
49+
"name": "Post data",
50+
"event": [
51+
{
52+
"listen": "test",
53+
"script": {
54+
"exec": [
55+
"pm.test(\"Successful POST request\", function () {",
56+
" pm.expect(pm.response.code).to.be.oneOf([200, 201]);",
57+
"});",
58+
""
59+
],
60+
"type": "text/javascript"
61+
}
62+
}
63+
],
64+
"request": {
65+
"method": "POST",
66+
"header": [],
67+
"body": {
68+
"mode": "raw",
69+
"raw": "{\n\t\"name\": \"Add your name in the body\"\n}",
70+
"options": {
71+
"raw": {
72+
"language": "json"
73+
}
74+
}
75+
},
76+
"url": {
77+
"raw": "{{base_url}}/info",
78+
"host": [
79+
"{{base_url}}"
80+
],
81+
"path": [
82+
"info"
83+
]
84+
},
85+
"description": "This is a POST request, submitting data to an API via the request body. This request submits JSON data, and the data is reflected in the response.\n\nA successful POST request typically returns a `200 OK` or `201 Created` response code."
86+
},
87+
"response": []
88+
},
89+
{
90+
"name": "Update data",
91+
"event": [
92+
{
93+
"listen": "test",
94+
"script": {
95+
"exec": [
96+
"pm.test(\"Successful PUT request\", function () {",
97+
" pm.expect(pm.response.code).to.be.oneOf([200, 201, 204]);",
98+
"});",
99+
""
100+
],
101+
"type": "text/javascript"
102+
}
103+
}
104+
],
105+
"request": {
106+
"method": "PUT",
107+
"header": [],
108+
"body": {
109+
"mode": "raw",
110+
"raw": "{\n\t\"name\": \"Add your name in the body\"\n}",
111+
"options": {
112+
"raw": {
113+
"language": "json"
114+
}
115+
}
116+
},
117+
"url": {
118+
"raw": "{{base_url}}/info?id=1",
119+
"host": [
120+
"{{base_url}}"
121+
],
122+
"path": [
123+
"info"
124+
],
125+
"query": [
126+
{
127+
"key": "id",
128+
"value": "1"
129+
}
130+
]
131+
},
132+
"description": "This is a PUT request and it is used to overwrite an existing piece of data. For instance, after you create an entity with a POST request, you may want to modify that later. You can do that using a PUT request. You typically identify the entity being updated by including an identifier in the URL (eg. `id=1`).\n\nA successful PUT request typically returns a `200 OK`, `201 Created`, or `204 No Content` response code."
133+
},
134+
"response": []
135+
},
136+
{
137+
"name": "Delete data",
138+
"event": [
139+
{
140+
"listen": "test",
141+
"script": {
142+
"exec": [
143+
"pm.test(\"Successful DELETE request\", function () {",
144+
" pm.expect(pm.response.code).to.be.oneOf([200, 202, 204]);",
145+
"});",
146+
""
147+
],
148+
"type": "text/javascript"
149+
}
150+
}
151+
],
152+
"request": {
153+
"method": "DELETE",
154+
"header": [],
155+
"body": {
156+
"mode": "raw",
157+
"raw": "",
158+
"options": {
159+
"raw": {
160+
"language": "json"
161+
}
162+
}
163+
},
164+
"url": {
165+
"raw": "{{base_url}}/info?id=1",
166+
"host": [
167+
"{{base_url}}"
168+
],
169+
"path": [
170+
"info"
171+
],
172+
"query": [
173+
{
174+
"key": "id",
175+
"value": "1"
176+
}
177+
]
178+
},
179+
"description": "This is a DELETE request, and it is used to delete data that was previously created via a POST request. You typically identify the entity being updated by including an identifier in the URL (eg. `id=1`).\n\nA successful DELETE request typically returns a `200 OK`, `202 Accepted`, or `204 No Content` response code."
180+
},
181+
"response": []
182+
}
183+
],
184+
"event": [
185+
{
186+
"listen": "prerequest",
187+
"script": {
188+
"type": "text/javascript",
189+
"exec": [
190+
""
191+
]
192+
}
193+
},
194+
{
195+
"listen": "test",
196+
"script": {
197+
"type": "text/javascript",
198+
"exec": [
199+
""
200+
]
201+
}
202+
}
203+
],
204+
"variable": [
205+
{
206+
"key": "id",
207+
"value": "1"
208+
},
209+
{
210+
"key": "base_url",
211+
"value": "https://postman-rest-api-learner.glitch.me/"
212+
}
213+
]
214+
}

0 commit comments

Comments
 (0)