Kotta commited on
Commit
1015a8a
·
1 Parent(s): 7bca2ed

feature(#9): updated saucelab tests with the configuration setup.

Browse files
.sauce/config.yml CHANGED
@@ -27,7 +27,7 @@ suites:
27
  testMatch:
28
  - 01 Send Notification
29
  # - 02 Upload Image
30
- - 03 Image Relatedness
31
  - 04 Add Feedback
32
  - 05 Get Feedback
33
  - 06 Get Commands
 
27
  testMatch:
28
  - 01 Send Notification
29
  # - 02 Upload Image
30
+ # - 03 Image Relatedness
31
  - 04 Add Feedback
32
  - 05 Get Feedback
33
  - 06 Get Commands
Brain/src/firebase/firebase.py CHANGED
@@ -19,9 +19,10 @@ def initialize_app(setting: ReqModel) -> firebase_admin.App:
19
  # Check if the app is already initialized
20
  try:
21
  app = firebase_admin.get_app(app_name)
22
- if app is not None:
23
- # Delete the existing app
24
- firebase_admin.delete_app(app)
 
25
  except Exception as ex:
26
  logger.warn(
27
  title="firebase init",
 
19
  # Check if the app is already initialized
20
  try:
21
  app = firebase_admin.get_app(app_name)
22
+ return app
23
+ # if app is not None:
24
+ # # Delete the existing app
25
+ # firebase_admin.delete_app(app)
26
  except Exception as ex:
27
  logger.warn(
28
  title="firebase init",
sauce_tests/01 Send Notification/unit.yaml CHANGED
@@ -1,13 +1,23 @@
1
  assertions:
2
  - id: post
3
  children:
 
 
 
4
  - id: body
5
  contentType: application/json
6
  content: >-
7
  {
8
- "message": "please search a image that shows a man and young boy.",
9
- "token": "eSyP3i7ITZuq8hWn2qutTl:APA91bH1FtWkaTSJwuX4WKWAl3Q-ZFyrOw4UtMP4IfwuvNrHOThH7EvEGIhtguilLRyQNlLiXatEN0xntHAc8bbKobSGjge3wxIHlspbIWY_855CzONqaVdl3y3zOmgKZNnuhYi4gwbh",
10
- "uuid": "test-uuid"
 
 
 
 
 
 
 
11
  }
12
  url: ${protocol}${domain}${endpoint}
13
  var: payload
@@ -17,8 +27,23 @@ assertions:
17
  value: application/json
18
  - id: assert-exists
19
  expression: payload
20
- - id: assert-exists
 
 
 
 
 
 
21
  expression: payload.message
22
  - id: assert-exists
23
  expression: payload.result
 
 
 
 
 
 
 
 
 
24
  configs: []
 
1
  assertions:
2
  - id: post
3
  children:
4
+ - id: header
5
+ name: User-Agent
6
+ value: Other
7
  - id: body
8
  contentType: application/json
9
  content: >-
10
  {
11
+ "openai_key": "",
12
+ "pinecone_key": "",
13
+ "pinecone_env": "",
14
+ "firebase_key": "",
15
+ "settings": {
16
+ "temperature": 0.6
17
+ },
18
+ "token": "eSyP3i7ITZuq8hWn2qutTl:APA91bH1FtWkaTSJwuX4WKWAl3Q-ZFyrOw4UtMP4IfwuvNrHOThH7EvEGIhtguilLRyQNlLiXatEN0xntHAc8bbKobSGjge3wxIHlspbIWY_855CzONqaVdl3y3zOmgKZNnuhYi4gwbh",
19
+ "uuid": "c40a09075d11940f",
20
+ "message": "Please search an image that shows Brown Teddy Bear"
21
  }
22
  url: ${protocol}${domain}${endpoint}
23
  var: payload
 
27
  value: application/json
28
  - id: assert-exists
29
  expression: payload
30
+ - id: assert-is
31
+ expression: payload.message
32
+ type: array
33
+ - id: each
34
+ children:
35
+ - id: assert-exists
36
+ expression: _1
37
  expression: payload.message
38
  - id: assert-exists
39
  expression: payload.result
40
+ - id: assert-exists
41
+ expression: payload.result.program
42
+ - id: assert-exists
43
+ expression: payload.result.content
44
+ - id: assert-exists
45
+ expression: payload.result.content.image_name
46
+ - id: assert-is
47
+ expression: payload.status_code
48
+ type: integer
49
  configs: []
sauce_tests/02 Upload Image/unit.yaml CHANGED
@@ -6,8 +6,15 @@ assertions:
6
  content: >-
7
  {
8
  "image_name": "0ddffe51-3763-48d9-ab74-2086de529217",
9
- "token": "eSyP3i7ITZuq8hWn2qutTl:APA91bH1FtWkaTSJwuX4WKWAl3Q-ZFyrOw4UtMP4IfwuvNrHOThH7EvEGIhtguilLRyQNlLiXatEN0xntHAc8bbKobSGjge3wxIHlspbIWY_855CzONqaVdl3y3zOmgKZNnuhYi4gwbh",
10
- "uuid": "test-uuid",
 
 
 
 
 
 
 
11
  "status": "updated"
12
  }
13
  url: ${protocol}${domain}${endpoint}
@@ -18,8 +25,21 @@ assertions:
18
  value: application/json
19
  - id: assert-exists
20
  expression: payload
21
- - id: assert-exists
 
 
 
 
 
 
22
  expression: payload.message
23
  - id: assert-exists
24
  expression: payload.result
 
 
 
 
 
 
 
25
  configs: []
 
6
  content: >-
7
  {
8
  "image_name": "0ddffe51-3763-48d9-ab74-2086de529217",
9
+ "token": "eSyP3i7ITZuq8hWn2qutTl:APA91bH1FtWkaTSJwuX4WKWAl3Q-ZFyrOw4UtMP4IfwuvNrHOThH7EvEGIhtguilLRyQNlLiXatEN0xntHAc8bbKobSGjge3wxIHlspbIWY_855CzONqaVdl3y3zOmgKZNnuhYi4gwbh",
10
+ "uuid": "test-uuid",
11
+ "openai_key": "",
12
+ "pinecone_key": "",
13
+ "pinecone_env": "",
14
+ "firebase_key": "",
15
+ "settings": {
16
+ "temperature": 0.6
17
+ },
18
  "status": "updated"
19
  }
20
  url: ${protocol}${domain}${endpoint}
 
25
  value: application/json
26
  - id: assert-exists
27
  expression: payload
28
+ - id: assert-is
29
+ expression: payload.message
30
+ type: array
31
+ - id: each
32
+ children:
33
+ - id: assert-exists
34
+ expression: _1
35
  expression: payload.message
36
  - id: assert-exists
37
  expression: payload.result
38
+ - id: assert-exists
39
+ expression: payload.result.image_name
40
+ - id: assert-exists
41
+ expression: payload.result.image_text
42
+ - id: assert-is
43
+ expression: payload.status_code
44
+ type: integer
45
  configs: []
sauce_tests/03 Image Relatedness/unit.yaml CHANGED
@@ -10,8 +10,15 @@ assertions:
10
  {
11
  "image_name": "0ddffe51-3763-48d9-ab74-2086de529217",
12
  "message": "This is the text about the image",
13
- "token": "eSyP3i7ITZuq8hWn2qutTl:APA91bH1FtWkaTSJwuX4WKWAl3Q-ZFyrOw4UtMP4IfwuvNrHOThH7EvEGIhtguilLRyQNlLiXatEN0xntHAc8bbKobSGjge3wxIHlspbIWY_855CzONqaVdl3y3zOmgKZNnuhYi4gwbh",
14
- "uuid": "test-uuid"
 
 
 
 
 
 
 
15
  }
16
  url: ${protocol}${domain}${endpoint}
17
  var: payload
@@ -21,10 +28,25 @@ assertions:
21
  value: application/json
22
  - id: assert-exists
23
  expression: payload
24
- - id: assert-exists
 
 
 
 
 
 
25
  expression: payload.message
26
  - id: assert-exists
27
  expression: payload.result
 
 
 
 
 
 
 
 
 
28
  configs: []
29
 
30
  # See https://github.com/saucelabs/saucectl-apix-example/blob/main/docs/README.md#unit-unityaml for more details about the syntax used in this file.
 
10
  {
11
  "image_name": "0ddffe51-3763-48d9-ab74-2086de529217",
12
  "message": "This is the text about the image",
13
+ "token": "eSyP3i7ITZuq8hWn2qutTl:APA91bH1FtWkaTSJwuX4WKWAl3Q-ZFyrOw4UtMP4IfwuvNrHOThH7EvEGIhtguilLRyQNlLiXatEN0xntHAc8bbKobSGjge3wxIHlspbIWY_855CzONqaVdl3y3zOmgKZNnuhYi4gwbh",
14
+ "uuid": "test-uuid",
15
+ "openai_key": "",
16
+ "pinecone_key": "",
17
+ "pinecone_env": "",
18
+ "firebase_key": "",
19
+ "settings": {
20
+ "temperature": 0.6
21
+ }
22
  }
23
  url: ${protocol}${domain}${endpoint}
24
  var: payload
 
28
  value: application/json
29
  - id: assert-exists
30
  expression: payload
31
+ - id: assert-is
32
+ expression: payload.message
33
+ type: array
34
+ - id: each
35
+ children:
36
+ - id: assert-exists
37
+ expression: _1
38
  expression: payload.message
39
  - id: assert-exists
40
  expression: payload.result
41
+ - id: assert-exists
42
+ expression: payload.result.program
43
+ - id: assert-exists
44
+ expression: payload.result.content
45
+ - id: assert-exists
46
+ expression: payload.result.content.image_name
47
+ - id: assert-is
48
+ expression: payload.status_code
49
+ type: integer
50
  configs: []
51
 
52
  # See https://github.com/saucelabs/saucectl-apix-example/blob/main/docs/README.md#unit-unityaml for more details about the syntax used in this file.
sauce_tests/04 Add Feedback/unit.yaml CHANGED
@@ -15,7 +15,14 @@ assertions:
15
  "image_name": "test_image",
16
  "message": "test_message"
17
  },
18
- "rating": 1
 
 
 
 
 
 
 
19
  }
20
  url: ${protocol}${domain}${endpoint}
21
  var: payload
@@ -25,8 +32,17 @@ assertions:
25
  value: application/json
26
  - id: assert-exists
27
  expression: payload
28
- - id: assert-exists
 
 
 
 
 
 
29
  expression: payload.message
30
  - id: assert-exists
31
  expression: payload.result
 
 
 
32
  configs: []
 
15
  "image_name": "test_image",
16
  "message": "test_message"
17
  },
18
+ "rating": 1,
19
+ "openai_key": "",
20
+ "pinecone_key": "",
21
+ "pinecone_env": "",
22
+ "firebase_key": "",
23
+ "settings": {
24
+ "temperature": 0.6
25
+ }
26
  }
27
  url: ${protocol}${domain}${endpoint}
28
  var: payload
 
32
  value: application/json
33
  - id: assert-exists
34
  expression: payload
35
+ - id: assert-is
36
+ expression: payload.message
37
+ type: array
38
+ - id: each
39
+ children:
40
+ - id: assert-exists
41
+ expression: _1
42
  expression: payload.message
43
  - id: assert-exists
44
  expression: payload.result
45
+ - id: assert-is
46
+ expression: payload.status_code
47
+ type: integer
48
  configs: []
sauce_tests/05 Get Feedback/input.yaml CHANGED
@@ -13,4 +13,4 @@
13
  children:
14
  - id: set
15
  children: []
16
- name: default
 
13
  children:
14
  - id: set
15
  children: []
16
+ name: default
sauce_tests/05 Get Feedback/unit.yaml CHANGED
@@ -1,16 +1,59 @@
1
  assertions:
2
- - id: get
3
- children: []
4
- url: ${protocol}${domain}${endpoint}
5
- var: payload
6
- mode: json
7
- - id: assert-equals
8
- expression: payload_response.headers['Content-Type']
9
- value: application/json
10
- - id: assert-exists
11
- expression: payload
12
- - id: assert-exists
13
- expression: payload.message
14
- - id: assert-exists
15
- expression: payload.result
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  configs: []
 
1
  assertions:
2
+ - id: post
3
+ children:
4
+ - id: body
5
+ contentType: application/json
6
+ content: |-
7
+ {
8
+ "openai_key": "",
9
+ "pinecone_key": "",
10
+ "pinecone_env": "",
11
+ "firebase_key": "",
12
+ "settings": {
13
+ "temperature": 0.6
14
+ }
15
+ }
16
+ url: ${protocol}${domain}${endpoint}
17
+ var: payload
18
+ mode: json
19
+ - id: assert-equals
20
+ expression: payload_response.headers['Content-Type']
21
+ value: application/json
22
+ - id: assert-exists
23
+ expression: payload
24
+ - id: assert-is
25
+ expression: payload.message
26
+ type: array
27
+ - id: each
28
+ children:
29
+ - id: assert-exists
30
+ expression: _1
31
+ expression: payload.message
32
+ - id: assert-is
33
+ expression: payload.result
34
+ type: array
35
+ - id: each
36
+ children:
37
+ - id: assert-exists
38
+ expression: _1.id
39
+ - id: assert-is
40
+ expression: _1.data.rating
41
+ type: integer
42
+ - id: assert-exists
43
+ expression: _1.data.completion.image_name
44
+ - id: assert-exists
45
+ expression: _1.data.completion.message
46
+ - id: assert-exists
47
+ expression: _1.data.prompt.image_name
48
+ - id: assert-exists
49
+ expression: _1.data.prompt.message
50
+ - id: assert-exists
51
+ expression: _1.data.uuid
52
+ - id: assert-is
53
+ expression: _1.data.timestamp
54
+ type: float
55
+ expression: payload.result.pick(5)
56
+ - id: assert-is
57
+ expression: payload.status_code
58
+ type: integer
59
  configs: []
sauce_tests/06 Get Commands/input.yaml CHANGED
@@ -1,4 +1,4 @@
1
- - id: global
2
  children:
3
  - id: variable
4
  name: protocol
@@ -13,4 +13,4 @@
13
  children:
14
  - id: set
15
  children: []
16
- name: default
 
1
+ - id: global
2
  children:
3
  - id: variable
4
  name: protocol
 
13
  children:
14
  - id: set
15
  children: []
16
+ name: default
sauce_tests/06 Get Commands/unit.yaml CHANGED
@@ -1,16 +1,48 @@
1
  assertions:
2
- - id: get
3
- children: []
4
- url: ${protocol}${domain}${endpoint}
5
- var: payload
6
- mode: json
7
- - id: assert-equals
8
- expression: payload_response.headers['Content-Type']
9
- value: application/json
10
- - id: assert-exists
11
- expression: payload
12
- - id: assert-exists
13
- expression: payload.message
14
- - id: assert-exists
15
- expression: payload.result
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  configs: []
 
1
  assertions:
2
+ - id: post
3
+ children:
4
+ - id: body
5
+ contentType: application/json
6
+ content: |-
7
+ {
8
+ "openai_key": "",
9
+ "pinecone_key": "",
10
+ "pinecone_env": "",
11
+ "firebase_key": "",
12
+ "settings": {
13
+ "temperature": 0.6
14
+ }
15
+ }
16
+ url: ${protocol}${domain}${endpoint}
17
+ var: payload
18
+ mode: json
19
+ - id: assert-equals
20
+ expression: payload_response.headers['Content-Type']
21
+ value: application/json
22
+ - id: assert-exists
23
+ expression: payload
24
+ - id: assert-is
25
+ expression: payload.message
26
+ type: array
27
+ - id: each
28
+ children:
29
+ - id: assert-exists
30
+ expression: _1
31
+ expression: payload.message
32
+ - id: assert-exists
33
+ expression: payload.result
34
+ - id: assert-exists
35
+ expression: payload.result.program
36
+ - id: assert-is
37
+ expression: payload.result.content
38
+ type: array
39
+ - id: each
40
+ children:
41
+ - id: assert-exists
42
+ expression: _1
43
+ expression: payload.result.content
44
+ - id: assert-is
45
+ expression: payload.status_code
46
+ type: integer
47
+
48
  configs: []
sauce_tests/07 Rising Chat/unit.yaml CHANGED
@@ -21,7 +21,13 @@ assertions:
21
  }
22
  ],
23
  "user_input": "Where was it played?",
24
- "model": "gpt-3.5-turbo"
 
 
 
 
 
 
25
  }
26
  url: ${protocol}${domain}${endpoint}
27
  var: payload
@@ -31,8 +37,25 @@ assertions:
31
  value: application/json
32
  - id: assert-exists
33
  expression: payload
34
- - id: assert-exists
 
 
 
 
 
 
35
  expression: payload.message
36
  - id: assert-exists
37
  expression: payload.result
 
 
 
 
 
 
 
 
 
 
 
38
  configs: []
 
21
  }
22
  ],
23
  "user_input": "Where was it played?",
24
+ "openai_key": "",
25
+ "pinecone_key": "",
26
+ "pinecone_env": "",
27
+ "firebase_key": "",
28
+ "settings": {
29
+ "temperature": 0.6
30
+ }
31
  }
32
  url: ${protocol}${domain}${endpoint}
33
  var: payload
 
37
  value: application/json
38
  - id: assert-exists
39
  expression: payload
40
+ - id: assert-is
41
+ expression: payload.message
42
+ type: array
43
+ - id: each
44
+ children:
45
+ - id: assert-exists
46
+ expression: _1
47
  expression: payload.message
48
  - id: assert-exists
49
  expression: payload.result
50
+ - id: assert-exists
51
+ expression: payload.result.program
52
+ - id: assert-exists
53
+ expression: payload.result.message
54
+ - id: assert-exists
55
+ expression: payload.result.message.role
56
+ - id: assert-exists
57
+ expression: payload.result.message.content
58
+ - id: assert-is
59
+ expression: payload.status_code
60
+ type: integer
61
  configs: []
sauce_tests/08 Train Contacts/unit.yaml CHANGED
@@ -12,7 +12,14 @@ assertions:
12
  "displayName": "Thomas",
13
  "phoneNumbers": ["217 374 8105"],
14
  "status": "updated"
15
- }]
 
 
 
 
 
 
 
16
  }
17
  url: ${protocol}${domain}${endpoint}
18
  var: payload
@@ -22,8 +29,17 @@ assertions:
22
  value: application/json
23
  - id: assert-exists
24
  expression: payload
25
- - id: assert-exists
 
 
 
 
 
 
26
  expression: payload.message
27
  - id: assert-exists
28
  expression: payload.result
 
 
 
29
  configs: []
 
12
  "displayName": "Thomas",
13
  "phoneNumbers": ["217 374 8105"],
14
  "status": "updated"
15
+ }],
16
+ "openai_key": "",
17
+ "pinecone_key": "",
18
+ "pinecone_env": "",
19
+ "firebase_key": "",
20
+ "settings": {
21
+ "temperature": 0.6
22
+ }
23
  }
24
  url: ${protocol}${domain}${endpoint}
25
  var: payload
 
29
  value: application/json
30
  - id: assert-exists
31
  expression: payload
32
+ - id: assert-is
33
+ expression: payload.message
34
+ type: array
35
+ - id: each
36
+ children:
37
+ - id: assert-exists
38
+ expression: _1
39
  expression: payload.message
40
  - id: assert-exists
41
  expression: payload.result
42
+ - id: assert-is
43
+ expression: payload.status_code
44
+ type: integer
45
  configs: []