You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2022/06/22 02:23:38 UTC
[incubator-devlake] branch main updated: refactor(tapd): add e2e for story category
This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new d71175e3 refactor(tapd): add e2e for story category
d71175e3 is described below
commit d71175e3f5b0991dda58edefe053bf7ea4a8729f
Author: Yingchu Chen <yi...@merico.dev>
AuthorDate: Tue Jun 21 23:32:47 2022 +0800
refactor(tapd): add e2e for story category
---
.../raw_tables/_raw_tapd_api_story_categories.csv | 4 ++
.../_tool_tapd_story_categories.csv | 4 ++
plugins/tapd/e2e/story_category_test.go | 66 ++++++++++++++++++++++
3 files changed, 74 insertions(+)
diff --git a/plugins/tapd/e2e/raw_tables/_raw_tapd_api_story_categories.csv b/plugins/tapd/e2e/raw_tables/_raw_tapd_api_story_categories.csv
new file mode 100644
index 00000000..9b31148c
--- /dev/null
+++ b/plugins/tapd/e2e/raw_tables/_raw_tapd_api_story_categories.csv
@@ -0,0 +1,4 @@
+id,params,data,url,input,created_at
+4,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}","{""Category"":{""id"":""11991001000179"",""workspace_id"":""991"",""name"":""None Category"",""description"":""test111test111test111"",""parent_id"":""0"",""modified"":""2020-02-13 10:16:27"",""created"":""2020-02-13 10:16:27"",""creator"":null,""modifier"":""test111test111""}}",https://api.tapd.cn/story_categories?workspace_id=991,null,2022-06-21 13:06:30.815
+5,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}","{""Category"":{""id"":""11991001000176"",""workspace_id"":""991"",""name"":""test111test111test111test111"",""description"":""test111test111test111test111"",""parent_id"":""0"",""modified"":""2020-02-13 10:16:20"",""created"":""2020-02-13 10:16:20"",""creator"":null,""modifier"":""TAPD""}}",https://api.tapd.cn/story_categories?workspace_id=991,null,2022-06-21 13:06:30.815
+6,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}","{""Category"":{""id"":""11991001000175"",""workspace_id"":""991"",""name"":""test111test111test111test111"",""description"":""test111test111test111test111"",""parent_id"":""0"",""modified"":""2020-02-13 10:16:20"",""created"":""2020-02-13 10:16:20"",""creator"":null,""modifier"":""TAPD""}}",https://api.tapd.cn/story_categories?workspace_id=991,null,2022-06-21 13:06:30.815
diff --git a/plugins/tapd/e2e/snapshot_tables/_tool_tapd_story_categories.csv b/plugins/tapd/e2e/snapshot_tables/_tool_tapd_story_categories.csv
new file mode 100644
index 00000000..e0cc6baf
--- /dev/null
+++ b/plugins/tapd/e2e/snapshot_tables/_tool_tapd_story_categories.csv
@@ -0,0 +1,4 @@
+connection_id,id,name,description,parent_id,created,modified,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
+1,11991001000175,test111test111test111test111,test111test111test111test111,0,2020-02-13T02:16:20.000+00:00,2020-02-13T02:16:20.000+00:00,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}",_raw_tapd_api_story_categories,6,
+1,11991001000176,test111test111test111test111,test111test111test111test111,0,2020-02-13T02:16:20.000+00:00,2020-02-13T02:16:20.000+00:00,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}",_raw_tapd_api_story_categories,5,
+1,11991001000179,None Category,test111test111test111,0,2020-02-13T02:16:27.000+00:00,2020-02-13T02:16:27.000+00:00,"{""ConnectionId"":1,""CompanyId"":99,""WorkspaceId"":991}",_raw_tapd_api_story_categories,4,
diff --git a/plugins/tapd/e2e/story_category_test.go b/plugins/tapd/e2e/story_category_test.go
new file mode 100644
index 00000000..5b76861a
--- /dev/null
+++ b/plugins/tapd/e2e/story_category_test.go
@@ -0,0 +1,66 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package e2e
+
+import (
+ "fmt"
+ "testing"
+
+ "github.com/apache/incubator-devlake/helpers/e2ehelper"
+ "github.com/apache/incubator-devlake/plugins/tapd/impl"
+ "github.com/apache/incubator-devlake/plugins/tapd/models"
+ "github.com/apache/incubator-devlake/plugins/tapd/tasks"
+)
+
+func TestTapdStoryCategoriesDataFlow(t *testing.T) {
+
+ var tapd impl.Tapd
+ dataflowTester := e2ehelper.NewDataFlowTester(t, "tapd", tapd)
+
+ taskData := &tasks.TapdTaskData{
+ Options: &tasks.TapdOptions{
+ ConnectionId: 1,
+ CompanyId: 99,
+ WorkspaceId: 991,
+ },
+ }
+ // import raw data table
+ dataflowTester.ImportCsvIntoRawTable("./raw_tables/_raw_tapd_api_story_categories.csv",
+ "_raw_tapd_api_story_categories")
+
+ // verify extraction
+ dataflowTester.FlushTabler(&models.TapdStoryCategory{})
+ dataflowTester.Subtask(tasks.ExtractStoryCategoriesMeta, taskData)
+ dataflowTester.VerifyTable(
+ models.TapdStoryCategory{},
+ fmt.Sprintf("./snapshot_tables/%s.csv", models.TapdStoryCategory{}.TableName()),
+ []string{"connection_id", "id"},
+ []string{
+ "name",
+ "description",
+ "parent_id",
+ "created",
+ "modified",
+ "_raw_data_params",
+ "_raw_data_table",
+ "_raw_data_id",
+ "_raw_data_remark",
+ },
+ )
+
+}