diff --git a/hubble-be/src/test/python/.DS_Store b/hubble-be/src/test/python/.DS_Store new file mode 100644 index 00000000..e46f618e Binary files /dev/null and b/hubble-be/src/test/python/.DS_Store differ diff --git a/hubble-be/src/test/python/scene10_select_single_collection_query.feature b/hubble-be/src/test/python/scene10_select_single_collection_query.feature new file mode 100644 index 00000000..c08a2e8b --- /dev/null +++ b/hubble-be/src/test/python/scene10_select_single_collection_query.feature @@ -0,0 +1,12 @@ +# language: en +Feature: select_by_id hugeGraph's gremlin-collections + + @lxb + Scenario Outline: select_by_id query_collections -- + When select_by_id query_collections -- 127.0.0.1:8088 + Given select_by_id query_collections + Then select_by_id query_collections -- + Examples: + | scene | ass | + | 查询单条语句 | {"status":200,"message":"None} | + diff --git a/hubble-be/src/test/python/scene11_update_collection_query.feature b/hubble-be/src/test/python/scene11_update_collection_query.feature new file mode 100644 index 00000000..728ee3b2 --- /dev/null +++ b/hubble-be/src/test/python/scene11_update_collection_query.feature @@ -0,0 +1,12 @@ +# language: en +Feature: update hugeGraph's gremlin-collections + + @lxb + Scenario Outline: update query_collections -- + When update query_collections -- 127.0.0.1:8088 + Given update query_collections -- + Then update query_collections -- + Examples: + | scene | action |ass | + | 更新收藏name改变 | update_name |{"status":200, "message":"None"} | + | 更新收藏content改变 | update_content |{"status":200, "message":"None"} | diff --git a/hubble-be/src/test/python/scene12_delete_collection_query.feature b/hubble-be/src/test/python/scene12_delete_collection_query.feature new file mode 100644 index 00000000..06a079ee --- /dev/null +++ b/hubble-be/src/test/python/scene12_delete_collection_query.feature @@ -0,0 +1,17 @@ +# language: en +Feature: delete hugeGraph's query_collections + + @lxb + Scenario Outline: delete query_connections -- + When delete query_connections -- 127.0.0.1:8088 -- + Given delete query_connections + Then delete query_connections -- + Examples: + | scene | param | ass | + | 删除收藏语句 | page_no=1&page_size=50 | {"status":200,"message":"None"} | + + + + + + diff --git a/hubble-be/src/test/python/scene13_select_execute_record.feature b/hubble-be/src/test/python/scene13_select_execute_record.feature new file mode 100644 index 00000000..8fe01e09 --- /dev/null +++ b/hubble-be/src/test/python/scene13_select_execute_record.feature @@ -0,0 +1,18 @@ +# language: en +Feature: select hugeGraph's execute_records + + @lxb + Scenario Outline: select execute_records -- + When select execute_records -- 127.0.0.1:8088 + Given select execute_records -- + Then select execute_records -- + Examples: + | scene | param | ass | + | page_size默认首页 | page_no=1 | {"status":200, "page_size":10, "page_no":1} | + | page_size默认尾页 | page_no=2 | {"status":200, "page_size":10, "page_no":2} | + | page_size && page_no默认 | null | {"status":200, "page_size":10, "page_no":1} | + | page_size>条数首页 | page_size=16&page_no=1 | {"status":200, "page_size":16, "page_no":1} | + | page_size<=条数首页 | page_size=3&page_no=1 | {"status":200, "page_size":3, "page_no":1} | + | page_size<条数尾页 | page_size=3&page_no=2 | {"status":200, "page_size":3, "page_no":2} | + + diff --git a/hubble-be/src/test/python/scene14_delete_execute_record.feature b/hubble-be/src/test/python/scene14_delete_execute_record.feature new file mode 100644 index 00000000..ca84e8c8 --- /dev/null +++ b/hubble-be/src/test/python/scene14_delete_execute_record.feature @@ -0,0 +1,12 @@ +# language: en +Feature: delete hugeGraph's execute_records + + @lxb + Scenario Outline: delete execute_records -- + When delete execute_records -- 127.0.0.1:8088 -- + Given delete execute_records + Then delete execute_records -- + Examples: + | scene | select_param | ass | + | 正例(删除) | page_size=100&page_no=1 | {"status":200,"data_status":"SUCCESS"} | + diff --git a/hubble-be/src/test/python/scene1_add_connections.feature b/hubble-be/src/test/python/scene1_add_connections.feature new file mode 100644 index 00000000..4738be54 --- /dev/null +++ b/hubble-be/src/test/python/scene1_add_connections.feature @@ -0,0 +1,36 @@ +# language: en +Feature: add hugeGraph's connections + + @lxb + Scenario Outline: add connections -- + When add connections -- request_host: 127.0.0.1:8088 + Given add connections -- param: + Then add connections -- compare_assert: + Examples: + | scene | param | ass | + | user不存在 | { "name": "hugegraph3_abnormal","graph" : "hugegraph3","host" : "127.0.0.1","port" : 8081,"password":"9fd95c9c-711b-415b-b85f-d4df46ba5c31"} | {"status":400, "message":""} | + | user为空 | { "name": "hugegraph3_abnormal","graph" : "hugegraph3","host" : "127.0.0.1","port" : 8081,"username":"","password":"9fd95c9c-711b-415b-b85f-d4df46ba5c31"} | {"status":400, "message":""} | + | password不存在 | { "name": "hugegraph3_abnormal","graph" : "hugegraph3","host" : "127.0.0.1","port" : 8081,"username":"hugegraph3"} | {"status":400, "message":""} | + | password为空 | { "name": "hugegraph3_abnormal","graph" : "hugegraph3","host" : "127.0.0.1","port" : 8081,"username":"hugegraph3","password":""} | {"status":400, "message":""} | + | name不存在 | { "graph" : "hugegraph1","host" : "127.0.0.1","port" : 8080} | {"status":400, "message":"参数 name 不能为 null 或空"} | + | name为空 | { "name": "","graph" : "hugegraph1","host" : "127.0.0.1","port" : 8080} | {"status":400, "message":"参数 name 不能为 null 或空"} | + | graph不存在 | { "name": "hugegraph1_abnormal","host" : "127.0.0.1","port" : 8080} | {"status":400, "message":"参数 graph 不能为 null 或空"} | + | graph为空 | { "name": "hugegraph1_abnormal","graph" : "","host" : "127.0.0.1","port" : 8080} | {"status":400, "message":"参数 graph 不能为 null 或空"} | + | host不存在 | { "name": "hugegraph1_abnormal","graph" : "hugegraph1","port" : 8080 } | {"status":400, "message":"参数 host 不能为 null 或空"} | + | host为空 | { "name": "hugegraph1_abnormal","graph" : "hugegraph1","host" : "","port" : 8080 } | {"status":400, "message":"参数 host 不能为 null 或空"} | + | port不存在 | { "name": "hugegraph1_abnormal","graph" : "hugegraph1","host" : "127.0.0.1"} | {"status":400, "message":"参数 port 不能为 null"} | + | port为空 | { "name": "hugegraph1_abnormal","graph" : "hugegraph1","host" : "127.0.0.1","port" : ""} | {"status":400, "message":"参数 port 不能为 null"} | + ### set dataset + | 正例(user不存在,password不存在) | { "name": "hugegraph1_ip","graph" : "hugegraph1","host" : "127.0.0.1","port" : 8080} | {"status":200,"message":"None"} | + | 正例(user不存在,password不存在) | { "name": "hugegraph1_host","graph" : "hugegraph1","host" : "localhost","port" : 8080} | {"status":200,"message":"None"} | + | 正例(user不存在,password不存在) | { "name": "hugegraph2_ip","graph" : "hugegraph2","host" : "127.0.0.1","port" : 8080} | {"status":200,"message":"None"} | + | 正例(user不存在,password不存在) | { "name": "hugegraph2_host","graph" : "hugegraph2","host" : "localhost","port" : 8080} | {"status":200,"message":"None"} | + | 正例(user存在,password存在) | { "name": "hugegraph3_ip","graph" : "hugegraph3","host" : "127.0.0.1","port" : 8081,"username":"hugegraph3","password":"9fd95c9c-711b-415b-b85f-d4df46ba5c31"} | {"status":200,"message":"None"} | + | 正例(user存在,password存在) | { "name": "hugegraph3_host","graph" : "hugegraph3","host" : "localhost","port" : 8081,"username":"hugegraph3","password":"9fd95c9c-711b-415b-b85f-d4df46ba5c31"} | {"status":200,"message":"None"} | + + + + + + + diff --git a/hubble-be/src/test/python/scene2_select_connections.feature b/hubble-be/src/test/python/scene2_select_connections.feature new file mode 100644 index 00000000..ac383367 --- /dev/null +++ b/hubble-be/src/test/python/scene2_select_connections.feature @@ -0,0 +1,22 @@ +# language: en +Feature: select hugeGraph's connections + + @lxb + Scenario Outline: select connections -- + When select connections -- request_host: 127.0.0.1:8088 + Given select connections -- param: + Then select connections -- compare_assert: + Examples: + | scene | param | ass | + | cotent字段搜索(图ID) | content=20 | {"status":200,"content":"id","id":1000} | + | cotent字段搜索(图名) | page_no=1&page_size=10&content=hugegraph1 | {"status":200,"content":"name","name":"hugegraph1"} | + | graph_order字段为desc | page_no=1&page_size=10&graph_order=desc | {"status":200,"graph_order":"desc"} | + | graph_order字段为asc | page_no=1&page_size=10&graph_order=asc | {"status":200,"graph_order":"asc"} | + | 默认排序 | page_no=1&page_size=10 | {"status":"200","graph_order":"default"} | + | 所有字段不存时 | null | {"status":200,"default":"all"} | + | page_size大于等于图链接数,查看首页 | page_no=1&page_size=10 | {"status":200, "page_no":1, "page_size":10} | + | page_size小于图链接数,查看首页 | page_no=1&page_size=3&content=hugegraph1 | {"status":200, "page_no":1, "page_size":3} | + | page_size小于图链接数,查看尾页 | page_no=2&page_size=3&content=hugegraph1 | {"status":200, "page_no":2, "page_size":3} | + | 所有字段都存在时 | page_no=1&page_size=10&content=hugegraph1&graph_order=asc | {"status":200} | + + diff --git a/hubble-be/src/test/python/scene3_update_connections.feature b/hubble-be/src/test/python/scene3_update_connections.feature new file mode 100644 index 00000000..f774f9fc --- /dev/null +++ b/hubble-be/src/test/python/scene3_update_connections.feature @@ -0,0 +1,14 @@ +# language: en +Feature: update hugeGraph's connections + + @lxb + Scenario Outline: update connections -- + When update connections -- request_host: 127.0.0.1:8088 + Given update connections + Then update connections -- + Examples: + | scene | ass | + | 更新name | {"status":200, "message":"None"} | + + + diff --git a/hubble-be/src/test/python/scene4_select_gremlin_query.feature b/hubble-be/src/test/python/scene4_select_gremlin_query.feature new file mode 100644 index 00000000..05ae5f90 --- /dev/null +++ b/hubble-be/src/test/python/scene4_select_gremlin_query.feature @@ -0,0 +1,22 @@ +# language: en +Feature: select hugeGraph's query + + @lxb + Scenario Outline: select gremlin_query -- + When select gremlin_query -- 127.0.0.1:8088 + Given select gremlin_query -- -- + Then select gremlin_query -- + Examples: + | scene | param | ass | + | 创建property_key | {"connection_id":0, "content": "graph.schema().propertyKey('name').asText().ifNotExist().create()\n graph.schema().propertyKey('age').asInt().ifNotExist().create() \n graph.schema().propertyKey('city').asText().ifNotExist().create() \n graph.schema().propertyKey('lang').asText().ifNotExist().create() \n graph.schema().propertyKey('date').asText().ifNotExist().create() \n graph.schema().propertyKey('price').asInt().ifNotExist().create()"} | {"status":200,"message":"None"} | + | 创建vertex_label | {"connection_id":0, "content": "person = graph.schema().vertexLabel('person').properties('name', 'age', 'city').primaryKeys('name').ifNotExist().create() \n software = graph.schema().vertexLabel('software').properties('name', 'lang', 'price').primaryKeys('name').ifNotExist().create()"} | {"status":200,"message":"None"} | + | 创建edge_label | {"connection_id":0, "content": "knows = graph.schema().edgeLabel('knows').sourceLabel('person').targetLabel('person').properties('date').ifNotExist().create() \n created = graph.schema().edgeLabel('created').sourceLabel('person').targetLabel('software').properties('date', 'city').ifNotExist().create()"} | {"status":200,"message":"None"} | + | 创建vertex & edge | {"connection_id":0, "content": "marko = graph.addVertex(T.label, 'person', 'name', 'marko', 'age', 29, 'city', 'Beijing') \n vadas = graph.addVertex(T.label, 'person', 'name', 'vadas', 'age', 27, 'city', 'Hongkong') \n lop = graph.addVertex(T.label, 'software', 'name', 'lop', 'lang', 'java', 'price', 328) \n josh = graph.addVertex(T.label, 'person', 'name', 'josh', 'age', 32, 'city', 'Beijing') \n ripple = graph.addVertex(T.label, 'software', 'name', 'ripple', 'lang', 'java', 'price', 199) \n peter = graph.addVertex(T.label, 'person','name', 'peter', 'age', 29, 'city', 'Shanghai') \n marko.addEdge('knows', vadas, 'date', '20160110') \n marko.addEdge('knows', josh, 'date', '20130220') \n marko.addEdge('created', lop, 'date', '20171210', 'city', 'Shanghai') \n josh.addEdge('created', ripple, 'date', '20151010', 'city', 'Beijing') \n josh.addEdge('created', lop, 'date', '20171210', 'city', 'Beijing') \n peter.addEdge('created', lop, 'date', '20171210', 'city', 'Beijing')"} | {"status":200,"message":"None"} | + | 正例查询 | {"connection_id":0, "content":"g.V().limit(20)"} | {"status":200,"message":"None"} | + + | connection_id字段不存在 | { "content":"g.V().limit(10)"} | {"status":400, "message":"None"} | + | connection_id字段错误 | {"connection_id":0, "content":"g.V().limit(10)"} | { "status":400, "message":"查找 id 为 0 的图连接失败" } | + | content字段为空 | {"connection_id":0, "content":""} | {"status":400, "message":"参数 gremlin-query.content 不能为 null 或空"} | + | content字段不存在 | {"connection_id":0} | {"status":400, "message":"参数 gremlin-query.content 不能为 null 或空"} | + + diff --git a/hubble-be/src/test/python/scene5_select_neighbor_vertices.feature b/hubble-be/src/test/python/scene5_select_neighbor_vertices.feature new file mode 100644 index 00000000..e4953eda --- /dev/null +++ b/hubble-be/src/test/python/scene5_select_neighbor_vertices.feature @@ -0,0 +1,18 @@ +# language: en +Feature: select hugeGraph's filter_vertices + + @lxb + Scenario Outline: neighbor_vertices -- + When neighbor_vertices -- 127.0.0.1:8088 + Given neighbor_vertices -- -- + Then neighbor_vertices -- + Examples: + | scene | param | ass | + | 正例 | {"connection_id":0, "vertex_id":"1:josh", "vertex_label": "person"} | {"status":200, "message":"None"} | + | connection_id字段不存在 | {"vertex_id":"1:josh","vertex_label": "person"} | {"status":400, "message":"None"} | + | connection_id字段错误 | {"connection_id":0, "vertex_id":"1:josh","vertex_label": "person"} | { "status":400, "message":"查找 id 为 0 的图连接失败" } | + | content字段为空 | {"connection_id":0, "vertex_id":"","vertex_label": "person"} | {"status":200,"message":"None"} | + | content字段不存在 | {"connection_id":0,"vertex_label": "person"} | {"status":400, "message":"参数 vertex_id 不能为 null"} | + | vertex_label字段为空 | {"connection_id":0, "vertex_id":"1:josh", "vertex_label": ""} | {"status":400, "message":"None"} | + | vertex_label字段不存在 | {"connection_id":0, "vertex_id":"1:josh"} | {"status":400, "message":"None"} | + diff --git a/hubble-be/src/test/python/scene6_select_filter_vertices.feature b/hubble-be/src/test/python/scene6_select_filter_vertices.feature new file mode 100644 index 00000000..ec33afc8 --- /dev/null +++ b/hubble-be/src/test/python/scene6_select_filter_vertices.feature @@ -0,0 +1,25 @@ +# language: en +Feature: select hugeGraph's filter_vertices_query + + @lxb + Scenario Outline: filter_vertices_query -- + When filter_vertices_query -- 127.0.0.1:8088 + Given filter_vertices_query -- -- + Then filter_vertices_query -- + Examples: + | scene | param | ass | + | 正例 | {"vertex_label":"person", "connection_id":0, "vertex_id":"1:marko", "direction": "OUT", "edge_label": "knows", "conditions": [{"key": "name", "operator": "gt", "value": 0.1}]} | {"status":200, "message":"None"} | + | connection_id字段不存在 | {"vertex_label":"person", "vertex_id":"1:marko", "direction": "OUT", "edge_label": "knows", "conditions": [{"key": "name", "operator": "gt", "value": 0.1}]} | {"status":400, "message":"None"} | + | connection_id字段错误 | {"vertex_label":"person", "connection_id":0, "vertex_id":"1:marko", "direction": "OUT", "edge_label": "knows", "conditions": [{"key": "name", "operator": "gt", "value": 0.1}]} | { "status":400, "message":"查找 id 为 0 的图连接失败" } | + | vertex_id字段错误 | {"vertex_label":"person", "connection_id":0, "vertex_id":"1:marko_error", "direction": "OUT", "edge_label": "knows", "conditions": [{"key": "name", "operator": "gt", "value": 0.1}]} | {"status":200, "message":"None"} | + | vertex_id字段不存在 | {"vertex_label":"person", "connection_id":0, "direction": "OUT", "edge_label": "knows", "conditions": [{"key": "name", "operator": "gt", "value": 0.1}]} | {"status":400, "message":"参数 vertex_id 不能为 null"} | + | direction字段不存在 | {"vertex_label":"person", "connection_id":0, "vertex_id":"1:marko", "edge_label": "knows", "conditions": [{"key": "name", "operator": "gt", "value": 0.1}]} | {"status":200, "message":"None"} | + | direction为BOTH | {"vertex_label":"person", "connection_id":0, "vertex_id":"1:marko", "direction": "BOTH", "edge_label": "knows", "conditions": [{"key": "name", "operator": "gt", "value": 0.1}]} | {"status":200, "message":"None"} | + | direction为OUT | {"vertex_label":"person", "connection_id":0, "vertex_id":"1:marko", "direction": "OUT", "edge_label": "knows", "conditions": [{"key": "name", "operator": "gt", "value": 0.1}]} | {"status":200, "message":"None"} | + | direction为IN| {"vertex_label":"person", "connection_id":0, "vertex_id":"1:marko", "direction": "IN", "edge_label": "knows", "conditions": [{"key": "name", "operator": "gt", "value": 0.1}]} | {"status":200, "message":"None"} | + | conditions字段不存在 | {"vertex_label":"person", "connection_id":0, "vertex_id":"1:marko", "direction": "OUT", "edge_label": "knows"} | {"status":200, "message":"None"} | + | conditions字段为空 | {"vertex_label":"person", "connection_id":0, "vertex_id":"1:marko", "direction": "OUT", "edge_label": "knows", "conditions": []} | {"status":200, "message":"None"} | + | edge_label字段为空 | {"vertex_label":"person", "connection_id":0, "vertex_id":"1:marko", "direction": "OUT", "edge_label": "", "conditions": [{"key": "name", "operator": "gt", "value": 0.1}]} | {"status":400, "message":"Gremlin 执行失败,详细信息: Edge label name can't be empty"} | + | edge_label字段不存在 | {"vertex_label":"person", "connection_id":0, "vertex_id":"1:marko", "direction": "OUT", "conditions": [{"key": "name", "operator": "gt", "value": 0.1}]} | {"status":200, "message":"None"} | + | vertex_label字段为空 | {"vertex_label":"", "connection_id":0, "vertex_id":"1:marko", "direction": "OUT", "edge_label": "knows", "conditions": [{"key": "name", "operator": "gt", "value": 0.1}]} | {"status":400, "message":"None"} | + | vertex_label字段不存在 | {"connection_id":25, "vertex_id":5, "direction": "IN", "conditions": [{"key": "weight", "operator": "gt", "value": 0.1}]} | {"status":400, "message":"参数 vertex_label 不能为 null"} | diff --git a/hubble-be/src/test/python/scene7_delete_connections.feature b/hubble-be/src/test/python/scene7_delete_connections.feature new file mode 100644 index 00000000..3f27125c --- /dev/null +++ b/hubble-be/src/test/python/scene7_delete_connections.feature @@ -0,0 +1,11 @@ +# language: en +Feature: delete hugeGraph's connections + + @lxb + Scenario Outline: delete hugeGraph's connections -- + When delete hugeGraph's connections -- 127.0.0.1:8088 + Given delete hugeGraph's connections + Then delete hugeGraph's connections -- + Examples: + | scene | ass | + | 删除图链接 | {"status":200, "message":"None"} | diff --git a/hubble-be/src/test/python/scene8_add_collection_query.feature b/hubble-be/src/test/python/scene8_add_collection_query.feature new file mode 100644 index 00000000..7f3bd3fd --- /dev/null +++ b/hubble-be/src/test/python/scene8_add_collection_query.feature @@ -0,0 +1,39 @@ +# language: en +Feature: add hugeGraph's query_collections + + @lxb + Scenario Outline: add query_connections -- + When add query_connections -- 127.0.0.1:8088 + Given add query_connections -- + Then add query_connections -- + Examples: + | scene | param | ass | + | 正例(name少于等于50字符) | {"name": "testLxb","content" : "g.V(5)"} | {"status":200,"message":"None"} | + | name重复 | { "name": "testLxb","content" : "g.V(5)"} | {"status":400,"message":"已存在名字为 testLxb 的 gremlin 语句"} | + | name存在'-' | { "name": "test-lxb","content" : "g.V(5)"} | {"status":400,"message":"语句名 test-lxb 不合法,语句名允许字母、数字、中文、下划线,最多48个字符"} | + | name大于50字符 | { "name": "test2jljfaoqpjjfalfjalfkjaldfjkvmklgjkajflkajflaj435664","content" : "g.V(5)"} | {"status":400,"message":"语句名 test2jljfaoqpjjfalfjalfkjaldfjkvmklgjkajflkajflaj435664 不合法,语句名允许字母、数字、中文、下划线,最多48个字符"} | + | name不存在 | {"content" : "g.V(5)"} | {"status":400,"message":"参数 name 不能为 null 或空"} | + | name为空 | { "name": "","content" : "g.V(5)"} | {"status":400,"message":"参数 name 不能为 null 或空"} | + | content不存在 | { "name": "test0Content"} | {"status":400,"message":"参数 content 不能为 null 或空"} | + | content为空 | { "name": "test1Content","content" : ""} | {"status":400,"message":"参数 content 不能为 null 或空"} | + ### 准备测试数据 + | 正例1 | { "name": "testLxb1","content" : "g.V(6)"} | {"status":200,"message":"None"} | + | 正例2 | { "name": "testLxb2","content" : "g.V(7)"} | {"status":200,"message":"None"} | + | 正例3 | { "name": "testLxb3","content" : "g.V(8)"} | {"status":200,"message":"None"} | + | 正例4 | { "name": "testLxb4","content" : "g.V(9)"} | {"status":200,"message":"None"} | + | 正例5 | { "name": "testLxb5","content" : "g.V(10)"} | {"status":200,"message":"None"} | + | 正例6 | { "name": "testLxb6","content" : "g.V(11)"} | {"status":200,"message":"None"} | + | 正例7 | { "name": "testLxb7","content" : "g.V(12)"} | {"status":200,"message":"None"} | + | 正例8 | { "name": "testLxb8","content" : "g.V(13)"} | {"status":200,"message":"None"} | + | 正例9 | { "name": "testLxb9","content" : "g.V(14)"} | {"status":200,"message":"None"} | + | 正例10 | { "name": "testLxb10","content" : "g.V(15)"} | {"status":200,"message":"None"} | + | 正例11 | { "name": "testLxb11","content" : "g.V(16)"} | {"status":200,"message":"None"} | + | 正例12 | { "name": "testLxb12","content" : "g.V(17)"} | {"status":200,"message":"None"} | + | 正例13 | { "name": "testLxb13","content" : "g.V(18)"} | {"status":200,"message":"None"} | + + + + + + + diff --git a/hubble-be/src/test/python/scene9_select_batch_collection_query.feature b/hubble-be/src/test/python/scene9_select_batch_collection_query.feature new file mode 100644 index 00000000..5a7762d7 --- /dev/null +++ b/hubble-be/src/test/python/scene9_select_batch_collection_query.feature @@ -0,0 +1,22 @@ +# language: en +Feature: select hugeGraph's query_collections + + @lxb + Scenario Outline: select query_collections(datesets:12)-- + When select query_collections -- 127.0.0.1:8088 + Given select query_collections -- + Then select query_collections -- + Examples: + | scene |param | ass | + | 正例(参数默认) | null | {"status":200, "page_size":10, "page_no":1} | + | content搜索语句名 | page_no=2 | {"status":200, "page_size":10, "page_no":2} | + | content搜索内容 | null | {"status":200, "page_size":10, "page_no":1} | + | name_order排序asc | page_size=16&page_no=1 | {"status":200, "page_size":16, "page_no":1} | + | name_order排序desc | page_size=8&page_no=1 | {"status":200, "page_size":8, "page_no":1} | + | page_no=1| page_size=8&page_no=2 | {"status":200, "page_size":8, "page_no":2} | + | page_no=2 | page_size=8&page_no=2 | {"status":200, "page_size":8, "page_no":2} | + | page_size=8| page_size=8&page_no=2 | {"status":200, "page_size":8, "page_no":2} | + | page_size=15 | page_size=8&page_no=2 | {"status":200, "page_size":8, "page_no":2} | + | page_size=15 & page_no=1| page_size=8&page_no=2 | {"status":200, "page_size":8, "page_no":2} | + | page_size=8 & page_no=2 | page_size=8&page_no=2 | {"status":200, "page_size":8, "page_no":2} | + diff --git a/hubble-be/src/test/python/steps/scene10_select_single_collection_query.py b/hubble-be/src/test/python/steps/scene10_select_single_collection_query.py new file mode 100644 index 00000000..af91dc53 --- /dev/null +++ b/hubble-be/src/test/python/steps/scene10_select_single_collection_query.py @@ -0,0 +1,43 @@ +# -*- coding: UTF-8 -*- +from behave import * +import requests +import sys +import json + +reload(sys) +sys.setdefaultencoding('utf8') +use_step_matcher("re") + + +@when("select_by_id query_collections -- (?P.+)") +def step_impl(context, text): + """ + :param text: + :type context: behave.runner.Context + """ + http_url = "http://" + text + "/api/v1.1/gremlin-collections" + res = requests.get(url=http_url + "?page_size=50&page_no=1") + context.http_url = http_url + context.res_list = res.json()["data"]["records"] + + +@given("select_by_id query_collections") +def step_impl(context): + """ + :type context: behave.runner.Context + """ + each_json = context.res_list[0] + select_single_url = context.http_url + res_select_single = requests.get(url=select_single_url + "/" + str(each_json["id"])) + context.res_select_single = res_select_single.json() + + +@then("select_by_id query_collections -- (?P.+)") +def step_impl(context, ass): + """ + :type context: behave.runner.Context + :type ass: str + """ + print "res_select_single ---> "+str(context.res_select_single) + ass_json = json.loads(ass) + assert (context.res_select_single["status"] == ass_json["status"]) and (ass_json["message"] == str(context.res_select_single["message"])) \ No newline at end of file diff --git a/hubble-be/src/test/python/steps/scene11_update_collection_query.py b/hubble-be/src/test/python/steps/scene11_update_collection_query.py new file mode 100644 index 00000000..8b118c51 --- /dev/null +++ b/hubble-be/src/test/python/steps/scene11_update_collection_query.py @@ -0,0 +1,53 @@ +# -*- coding: UTF-8 -*- +from behave import * +import requests +import sys +import json + +reload(sys) +sys.setdefaultencoding('utf8') +use_step_matcher("re") + + +@when("update query_collections -- (?P.+)") +def step_impl(context, text): + """ + :param text: + :type context: behave.runner.Context + """ + http_url = "http://" + text + "/api/v1.1/gremlin-collections" + res = requests.get(url=http_url + "?page_size=50&page_no=1") + context.http_url = http_url + context.res_list = res.json()["data"]["records"] + + +@given("update query_collections -- (?P.+)") +def step_impl(context, action): + """ + :type context: behave.runner.Context + """ + each_json = context.res_list[0] + update_url = context.http_url + update_json = {} + if "name" in action: + update_json["name"] = "testLXBtest" + update_json["content"] = each_json["content"] + elif "content" in action: + update_json["content"] = "testLXBtest" + update_json["name"] = each_json["name"] + else: + pass + res_update = requests.put(url=update_url + "/" + str(each_json["id"]), json=update_json) + context.res_ud = res_update.json() + + +@then("update query_collections -- (?P.+)") +def step_impl(context, ass): + """ + :type context: behave.runner.Context + :type ass: str + """ + update_jn = context.res_ud + print "update ---> " + str(update_jn) + ass_json = json.loads(ass) + assert (update_jn["status"] == ass_json["status"]) and (ass_json["message"] == str(update_jn["message"])) diff --git a/hubble-be/src/test/python/steps/scene12_delete_collection_query.py b/hubble-be/src/test/python/steps/scene12_delete_collection_query.py new file mode 100644 index 00000000..28a23c0d --- /dev/null +++ b/hubble-be/src/test/python/steps/scene12_delete_collection_query.py @@ -0,0 +1,54 @@ +# -*- coding: UTF-8 -*- +from behave import * +import requests +import sys +import json + +reload(sys) +sys.setdefaultencoding('utf8') +use_step_matcher("re") + + +@when("delete query_connections -- (?P.+) -- (?P.+)") +def step_impl(context, text, param): + """ + :type context: behave.runner.Context + :type text: str + :type param: str + """ + http_url = "http://" + text + "/api/v1.1/gremlin-collections" + res = requests.get(url=http_url + "?" + param) + context.http_url = http_url + context.res_json = res.json() + + +@given("delete query_connections") +def step_impl(context): + """ + :type context: behave.runner.Context + """ + select_list = context.res_json["data"]["records"] + context.select_list = select_list + + +@then("delete query_connections -- (?P.+)") +def step_impl(context, ass): + """ + :type context: behave.runner.Context + :type ass: str + """ + ass_json = json.loads(ass) + print "ass_json --" + str(ass_json) + print " select_list " + str(context.select_list) + flag = True + for jn in context.select_list: + id = jn["id"] + del_url = context.http_url + "/" + str(id) + del_res = requests.delete(url=del_url) + print "del_res -- " + str(del_res.json()) + if (del_res.json()["status"] != ass_json["status"]) or (ass_json["message"] != str(del_res.json()["message"])): + flag = False + break + else: + pass + assert flag diff --git a/hubble-be/src/test/python/steps/scene13_select_execute_record.py b/hubble-be/src/test/python/steps/scene13_select_execute_record.py new file mode 100644 index 00000000..474744b8 --- /dev/null +++ b/hubble-be/src/test/python/steps/scene13_select_execute_record.py @@ -0,0 +1,56 @@ +# -*- coding: UTF-8 -*- +from behave import * +import requests +import sys +import json + +reload(sys) +sys.setdefaultencoding('utf8') +use_step_matcher("re") + + +@when("select execute_records -- (?P.+)") +def step_impl(context, text): + """ + :param text: + :type context: behave.runner.Context + """ + http_url = "http://" + text + "/api/v1.1/execute-histories" + context.http_url = http_url + + +@given("select execute_records -- (?P.+)") +def step_impl(context, param): + """ + :type context: behave.runner.Context + :type param: str + """ + if param == "null": + select_url = context.http_url + select_res = requests.get(url=select_url) + context.select_res = select_res.json() + else: + select_url = context.http_url + "?" + param + select_res = requests.get(url=select_url) + context.select_res = select_res.json() + + +@then("select execute_records -- (?P.+)") +def step_impl(context, ass): + """ + :type context: behave.runner.Context + :type ass: str + """ + select_json = context.select_res + list_dataset = select_json["data"]["records"] + size = len(list_dataset) + ass_json = json.loads(ass) + page_size = ass_json["page_size"] + page_no = ass_json["page_no"] + print " -- select_json --> "+str(select_json) + if 14 >= page_size*page_no: + assert (select_json["status"] == ass_json["status"] and size == page_size) + else: + assert (select_json["status"] == ass_json["status"] and size < page_size) + + diff --git a/hubble-be/src/test/python/steps/scene14_delete_execute_record.py b/hubble-be/src/test/python/steps/scene14_delete_execute_record.py new file mode 100644 index 00000000..ac78502d --- /dev/null +++ b/hubble-be/src/test/python/steps/scene14_delete_execute_record.py @@ -0,0 +1,48 @@ +# -*- coding: UTF-8 -*- +from behave import * +import requests +import sys +import json + +reload(sys) +sys.setdefaultencoding('utf8') +use_step_matcher("re") + + +@when("delete execute_records -- (?P.+) -- (?P.+)") +def step_impl(context, text, select_param): + """ + :param select_param: + :param text: + :type context: behave.runner.Context + """ + http_url = "http://" + text + "/api/v1.1/execute-histories" + context.http_url = http_url + select_url = http_url + "?" + select_param + context.select_url = select_url + + +@given("delete execute_records") +def step_impl(context): + """ + :type context: behave.runner.Context + """ + select_res = requests.get(url=context.select_url) + list_res = select_res.json()["data"]["records"] + print "list_res --- " + str(list_res) + context.del_list = list_res + + +@then("delete execute_records -- (?P.+)") +def step_impl(context, ass): + """ + :type context: behave.runner.Context + :type ass: str + """ + ass_json = json.loads(ass) + id = context.del_list[0]["id"] + del_url = context.http_url + "/" + str(id) + del_res = requests.delete(url=del_url) + print "del_res ---"+str(del_res.json()) + assert (del_res.json()["status"] == ass_json["status"]) \ + and (del_res.json()["data"]["status"] == ass_json["data_status"]) \ No newline at end of file diff --git a/hubble-be/src/test/python/steps/scene1_add_connections.py b/hubble-be/src/test/python/steps/scene1_add_connections.py new file mode 100644 index 00000000..d35096cf --- /dev/null +++ b/hubble-be/src/test/python/steps/scene1_add_connections.py @@ -0,0 +1,45 @@ +# -*- coding: UTF-8 -*- +from behave import * +import requests +import sys +import json + +reload(sys) +sys.setdefaultencoding('utf8') +use_step_matcher("re") + + +@when("add connections -- request_host: (?P.+)") +def step_impl(context, text): + """ + :param text: + :type context: behave.runner.Context + """ + http_url = "http://" + text + "/api/v1.1/graph-connections" + context.http_url = http_url + + +@given("add connections -- param: (?P.+)") +def step_impl(context, param): + """ + :type context: behave.runner.Context + :type param: str + """ + url = context.http_url + payload = json.loads(param) + res = requests.post(url=url, json=payload) + context.res_json = res.json() + + +@then("add connections -- compare_assert: (?P.+)") +def step_impl(context, ass): + """ + :type context: behave.runner.Context + :type ass: str + :type scene: str + """ + res_json = context.res_json + print "res_json -- "+str(res_json) + ass_json = json.loads(ass) + print "ass_json --" + str(ass_json) + assert (res_json["status"] == ass_json["status"]) and (str(res_json["message"]) == ass_json["message"]) diff --git a/hubble-be/src/test/python/steps/scene2_select_connections.py b/hubble-be/src/test/python/steps/scene2_select_connections.py new file mode 100644 index 00000000..a4f46a3d --- /dev/null +++ b/hubble-be/src/test/python/steps/scene2_select_connections.py @@ -0,0 +1,107 @@ +# -*- coding: UTF-8 -*- +from behave import * +import requests +import sys +import json + +reload(sys) +sys.setdefaultencoding('utf8') +use_step_matcher("re") + + +@when("select connections -- request_host: (?P.+)") +def step_impl(context, text): + """ + :param text: + :type context: behave.runner.Context + """ + http_url = "http://" + text + "/api/v1.1/graph-connections" + context.http_url = http_url + + +@given("select connections -- param: (?P.+)") +def step_impl(context, param): + """ + :type context: behave.runner.Context + :type param: str + """ + if param == "null": + res = requests.get(context.http_url) + context.res_json = res.json() + + else: + res = requests.get(url=context.http_url + "?" + param) + context.res_json = res.json() + + +@then("select connections -- compare_assert: (?P.+)") +def step_impl(context, ass): + """ + :type context: behave.runner.Context + :type ass: str + """ + res_json = context.res_json + print 'res_json ---> ' + str(res_json) + ass_json = json.loads(ass) + print 'ass_json ---> ' + str(ass_json) + if res_json["status"] == ass_json["status"]: + assert True + # ### 排序、分页 搜索 默认 + # if (not ass_json.has_key("graphOrder")) \ + # and (not ass_json.has_key("pageSize")) \ + # and (not ass_json.has_key("content")): + # ### 默认分页为 10 + # list = res_json["data"]["records"] + # list_sort = res_json["data"]["records"] + # size = len(list) + # if size <= 10: + # ### 默认 时间排序 + # list_sort.sort() + # flag = True + # for n in range(0, size): + # if list[n] == list_sort[n]: + # pass + # else: + # flag = False + # assert flag + # else: + # pass + # else: + # pass + # + # ### 分页 + # if ass_json.has_key("pageSize"): + # assert True + # else: + # pass + # + # ### 排序 + # if ass_json.has_key("graphOrder"): + # assert True + # else: + # pass + # + # ### 搜索 + # if ass_json.has_key("content"): + # content_list = res_json["data"]["records"] + # if ass_json["content"] == "id": + # if content_list[0]["id"] == ass_json["id"]: + # assert True + # else: + # assert False + # elif ass_json["content"] == "name": + # if content_list[0]["name"] == ass_json["name"]: + # assert True + # else: + # assert False + # else: + # assert False + # else: + # pass + # ### 默认查询 ### + # if ass_json.has_key("default"): + # assert True + # else: + # assert False + else: + assert False diff --git a/hubble-be/src/test/python/steps/scene3_update_connections.py b/hubble-be/src/test/python/steps/scene3_update_connections.py new file mode 100644 index 00000000..1901b2aa --- /dev/null +++ b/hubble-be/src/test/python/steps/scene3_update_connections.py @@ -0,0 +1,54 @@ +# -*- coding: UTF-8 -*- +from behave import * +import requests +import sys +import json + +reload(sys) +sys.setdefaultencoding('utf8') +use_step_matcher("re") + + +@when("update connections -- request_host: (?P.+)") +def step_impl(context, text): + """ + :param text: + :type context: behave.runner.Context + """ + http_url = "http://" + text + "/api/v1.1/graph-connections" + res = requests.get(url=http_url) + context.http_url = http_url + context.res_json = res.json() + + +@given("update connections") +def step_impl(context): + """ + :type context: behave.runner.Context + """ + res_json = context.res_json + if res_json["status"] == 200: + json_res = res_json["data"]["records"][0] + id = json_res["id"] + update_url = context.http_url+"/"+str(id) + update_json = {"name": "updateConnections", "graph": json_res["graph"], "host": json_res["host"], + "port": json_res["port"]} + res_update = requests.put(url=update_url, json=update_json) + context.update_jn = res_update.json() + else: + print 'create connection : failed !' + assert False + + +@then("update connections -- (?P.+)") +def step_impl(context, ass): + """ + :type context: behave.runner.Context + :type ass: str + """ + update_jn = context.update_jn + print "update_jn -- "+str(update_jn) + ass_json = json.loads(ass) + print "ass_json -- "+str(ass_json) + assert (update_jn["status"] == ass_json["status"]) and (ass_json["message"] == str(update_jn["message"])) + diff --git a/hubble-be/src/test/python/steps/scene4_select_gremlin_query.py b/hubble-be/src/test/python/steps/scene4_select_gremlin_query.py new file mode 100644 index 00000000..b9907eff --- /dev/null +++ b/hubble-be/src/test/python/steps/scene4_select_gremlin_query.py @@ -0,0 +1,64 @@ +# -*- coding: UTF-8 -*- +from behave import * +import requests +import sys +import json + +reload(sys) +sys.setdefaultencoding('utf8') +use_step_matcher("re") +### the premise +# http_url = "http://127.0.0.1:8088/api/v1.1/graph-connections" +# payload = {"name": "hugegraph3_ip", +# "graph": "hugegraph3", +# "host": "127.0.0.1", +# "port": 8081, +# "username": "hugegraph3", +# "password": "9fd95c9c-711b-415b-b85f-d4df46ba5c31"} +# res = requests.post(url=http_url, json=payload) +# print "select_connections : "+str(res.json()) +# id = res.json()["data"]["id"] + + +@when("select gremlin_query -- (?P.+)") +def step_impl(context, text): + """ + :param text: + :type context: behave.runner.Context + """ + http_url = "http://" + text + "/api/v1.1/graph-connections" + res = requests.get(http_url) + print "select_connections : "+str(res.json()) + context.id = res.json()["data"]["records"][-1]["id"] + context.url = text + + +@given("select gremlin_query -- (?P.+) -- (?P.+)") +def step_impl(context, scene,param): + """ + :param text: + :type context: behave.runner.Context + :type param: str + """ + select_url = "http://" + context.url + "/api/v1.1/gremlin-query" + param_json = json.loads(param) + if "connection_id" not in scene: + param_json["connection_id"] = context.id + else: + pass + # param_json["connection_id"] = id + print "param_json: "+str(param_json) + res = requests.post(url=select_url, json=param_json) + context.res = res.json() + + +@then("select gremlin_query -- (?P.+)") +def step_impl(context, ass): + """ + :type context: behave.runner.Context + :type ass: str + """ + res_json = context.res + print "res ---> " + str(res_json) + ass_json = json.loads(ass) + assert (res_json["status"] == ass_json["status"]) and (str(res_json["message"]) == ass_json["message"]) \ No newline at end of file diff --git a/hubble-be/src/test/python/steps/scene5_select_neighbor_vertices.py b/hubble-be/src/test/python/steps/scene5_select_neighbor_vertices.py new file mode 100644 index 00000000..dcfc284d --- /dev/null +++ b/hubble-be/src/test/python/steps/scene5_select_neighbor_vertices.py @@ -0,0 +1,52 @@ +# -*- coding: UTF-8 -*- +from behave import * +import requests +import sys +import json + +reload(sys) +sys.setdefaultencoding('utf8') +use_step_matcher("re") + + +@when("neighbor_vertices -- (?P.+)") +def step_impl(context, text): + """ + :type context: behave.runner.Context + :type text: str + """ + http_url = "http://" + text + "/api/v1.1/graph-connections" + res = requests.get(http_url) + print "select_connections : " + str(res.json()) + context.id = res.json()["data"]["records"][-1]["id"] + context.url = text + + +@given("neighbor_vertices -- (?P.+) -- (?P.+)") +def step_impl(context, scene, param): + """ + :param scene: + :type context: behave.runner.Context + :type param: str + """ + select_url = "http://" + context.url + "/api/v1.1/gremlin-query" + param_json = json.loads(param) + if "connection_id" not in scene: + param_json["connection_id"] = context.id + else: + pass + print "param_json: " + str(param_json) + res = requests.put(url=select_url, json=param_json) + context.res = res.json() + + +@then("neighbor_vertices -- (?P.+)") +def step_impl(context, ass): + """ + :type context: behave.runner.Context + :type ass: str + """ + res_json = context.res + print "res ---> " + str(res_json) + ass_json = json.loads(ass) + assert res_json["status"] == ass_json["status"] diff --git a/hubble-be/src/test/python/steps/scene6_select_filter_vertices.py b/hubble-be/src/test/python/steps/scene6_select_filter_vertices.py new file mode 100644 index 00000000..e45969d2 --- /dev/null +++ b/hubble-be/src/test/python/steps/scene6_select_filter_vertices.py @@ -0,0 +1,53 @@ +# -*- coding: UTF-8 -*- +from behave import * +import requests +import sys +import json + +reload(sys) +sys.setdefaultencoding('utf8') +use_step_matcher("re") + + +@when("filter_vertices_query -- (?P.+)") +def step_impl(context, text): + """ + :type context: behave.runner.Context + :type text: str + """ + http_url = "http://" + text + "/api/v1.1/graph-connections" + res = requests.get(http_url) + print "select_connections : " + str(res.json()) + context.id = res.json()["data"]["records"][-1]["id"] + context.url = text + + +@given("filter_vertices_query -- (?P.+) -- (?P.+)") +def step_impl(context, scene, param): + """ + :param scene: + :type context: behave.runner.Context + :type param: str + """ + select_url = "http://" + context.url + "/api/v1.1/gremlin-query" + param_json = json.loads(param) + if "connection_id" not in scene: + param_json["connection_id"] = context.id + else: + pass + print "param_json: " + str(param_json) + res = requests.put(url=select_url, json=param_json) + context.res = res.json() + + +@then("filter_vertices_query -- (?P.+)") +def step_impl(context, ass): + """ + :type context: behave.runner.Context + :type ass: str + """ + res_json = context.res + print "res ---> " + str(res_json) + ass_json = json.loads(ass) + print "ass_json ---> " + str(ass_json) + assert res_json["status"] == ass_json["status"] \ No newline at end of file diff --git a/hubble-be/src/test/python/steps/scene7_delete_connections.py b/hubble-be/src/test/python/steps/scene7_delete_connections.py new file mode 100644 index 00000000..3e89a11d --- /dev/null +++ b/hubble-be/src/test/python/steps/scene7_delete_connections.py @@ -0,0 +1,56 @@ +# -*- coding: UTF-8 -*- +from behave import * +import requests +import sys +import json + +reload(sys) +sys.setdefaultencoding('utf8') +use_step_matcher("re") + + +@when("delete hugeGraph's connections -- (?P.+)") +def step_impl(context, text): + """ + :param text: + :type context: behave.runner.Context + """ + http_url = "http://" + text + "/api/v1.1/graph-connections" + res = requests.get(url=http_url) + context.http_url = http_url + print "res.json() --- " + str(res.json()) + context.res_json = res.json() + + +@given("delete hugeGraph's connections") +def step_impl(context): + """ + :type context: behave.runner.Context + """ + res_json = context.res_json + if res_json["status"] == 200: + list_res = res_json["data"]["records"] + context.list_res = list_res + else: + print 'create connection : failed !' + assert False + + +@then("delete hugeGraph's connections -- (?P.+)") +def step_impl(context, ass): + """ + :type context: behave.runner.Context + :type ass: str + """ + ass_json = json.loads(ass) + list_res = context.list_res + flag = True + for res_json in list_res: + url = context.http_url + "/" + str(res_json["id"]) + del_json = requests.delete(url).json() + if (del_json["status"] != ass_json["status"]) or (ass_json["message"] != str(del_json["message"])): + assert False + break + else: + pass + assert flag diff --git a/hubble-be/src/test/python/steps/scene8_add_collection_query.py b/hubble-be/src/test/python/steps/scene8_add_collection_query.py new file mode 100644 index 00000000..bd31c77b --- /dev/null +++ b/hubble-be/src/test/python/steps/scene8_add_collection_query.py @@ -0,0 +1,43 @@ +# -*- coding: UTF-8 -*- +from behave import * +import requests +import sys +import json + +reload(sys) +sys.setdefaultencoding('utf8') +use_step_matcher("re") + + +@when("add query_connections -- (?P.+)") +def step_impl(context, text): + """ + :param text: + :type context: behave.runner.Context + """ + http_url = "http://" + text + "/api/v1.1/gremlin-collections" + context.url = http_url + + +@given("add query_connections -- (?P.+)") +def step_impl(context, param): + """ + :type context: behave.runner.Context + :type param: str + """ + add_url = context.url + payload = json.loads(param) + add_res = requests.post(url=add_url, json=payload) + context.add_res = add_res.json() + + +@then("add query_connections -- (?P.+)") +def step_impl(context, ass): + """ + :type context: behave.runner.Context + :type ass: str + """ + add_res = context.add_res + ass_json = json.loads(ass) + print " ---> " + str(add_res) + assert(add_res["status"] == ass_json["status"]) and (ass_json["message"] == str(add_res["message"])) \ No newline at end of file diff --git a/hubble-be/src/test/python/steps/scene9_select_batch_collection_query.py b/hubble-be/src/test/python/steps/scene9_select_batch_collection_query.py new file mode 100644 index 00000000..15a65c69 --- /dev/null +++ b/hubble-be/src/test/python/steps/scene9_select_batch_collection_query.py @@ -0,0 +1,74 @@ +# -*- coding: UTF-8 -*- +from behave import * +import requests +import sys +import json + +reload(sys) +sys.setdefaultencoding('utf8') +use_step_matcher("re") + + +@when('select query_collections -- (?P.+)') +def step_impl(context, text): + """ + :param text: + :type context: behave.runner.Context + """ + http_url = "http://" + text + "/api/v1.1/gremlin-collections" + context.http_url = http_url + + +@given("select query_collections -- (?P.+)") +def step_impl(context, param): + """ + :type context: behave.runner.Context + :type param: str + """ + context.pa = param + if param == "null": + select_url = context.http_url + select_res = requests.get(url=select_url) + context.select_res = select_res.json() + else: + select_url = context.http_url + "?" + param + select_res = requests.get(url=select_url) + context.select_res = select_res.json() + + +@then("select query_collections -- (?P.+)") +def step_impl(context, ass): + """ + :type context: behave.runner.Context + :type ass: str + """ + ass_json = json.loads(ass) + param = context.pa + res_json = context.select_res + print "res_json ---> " + str(res_json) + if ass_json["status"] == res_json["status"]: + assert True + # list_res = res_json["data"]["records"] + # + # if "content" in param: ### 验证 content + # pass + # elif "order_name" in param: ### 验证 name_order + # pass + # else: ### 验证 默认情况 或者 page_size 和 page_no 有参数 + # list_sort = res_json["data"]["records"] + # list_sort.sort() + # size_res = len(list_sort) + # flag = True + # for n in range(0,size_res): + # if list_sort[n] == list_res[n]: + # pass + # else: + # flag = False + # page_size = res_json["page_size"] + # page_no = ass_json["page_no"] + # if 14 >= page_size * page_no: + # assert (size_res == page_size) + # else: + # assert (size_res < page_size) + else: + assert False