Browse Source

Remove Slack from test_SendReports

Akash Singh 3 years ago
parent
commit
a3fe8a2554
3 changed files with 2 additions and 13 deletions
  1. 2 0
      baangt/base/TestRun/TestRun.py
  2. 0 1
      tests/0TestInput/sendstatistics.ini
  3. 0 12
      tests/test_SendReports.py

+ 2 - 0
baangt/base/TestRun/TestRun.py

@@ -91,6 +91,8 @@ class TestRun:
         self.tearDown()
 
         if ".csv" in self.results.fileName:
+            # If output file is of CSV Format then we are creating a temporary xlsx file which is just used to
+            # send reports and get deleted after that.
             temp_file = self.results.fileName + ".xlsx"
             self.results.workbook = xlsxwriter.Workbook(temp_file)
             self.results.summarySheet = self.results.workbook.add_worksheet("Summary")

+ 0 - 1
tests/0TestInput/sendstatistics.ini

@@ -3,5 +3,4 @@ telegramchannel = baangt_test
 sendmailto =
 notificationwithattachment =
 mswebhook = https://outlook.office.com/webhook/58959113-0806-4a13-9083-aded420f6cbb@cb0daf37-b006-4329-acf8-768173ebb4d1/IncomingWebhook/577f963298ae42bb8c17b5b231b016c5/1afcd612-f252-44d4-a736-e7381cb77d7e
-slackwebhook = https://hooks.slack.com/services/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
 telegrambot = 1130436643:AAHWFuYGmtOm5ACnXBSuY6fgp9LAECUAmNM

+ 0 - 12
tests/test_SendReports.py

@@ -13,7 +13,6 @@ def readConfig():
     config_file = Path(os.getcwd()).joinpath("tests").joinpath("0TestInput").joinpath("sendstatistics.ini")
     print(config_file)
     config.read(config_file)
-    globalSettings["SlackWebHook"] = config["Default"].get("SlackWebHook")
     globalSettings["TelegramBot"] = config["Default"].get("TelegramBot")
     globalSettings["TelegramChannel"] = config["Default"].get("TelegramChannel")
     return globalSettings
@@ -22,17 +21,6 @@ settings = readConfig()
 send_stats = Sender(settings, "tests/0TestInput/sendstatistics.xlsx")
 subject, body = send_stats.create_body()
 
-def test_slack():
-    send_stats.sendSlack()
-    text = subject + "\n\n" + body
-    token = "xoxb-1046914962533-1180874542160-Zw0JNcKcYholZ8QLxGMliWJB"
-    channel = "C014DRKRE30"
-    url = f'https://slack.com/api/channels.history?token={token}&channel={channel}&count=5'
-    res = requests.get(url)
-    js = json.loads(res.content)
-    messages = [m['text'] for m in js['messages']]
-    assert text in messages
-
 def test_telegram():
     messages = send_stats.sendTelegram(test=True)
     text = subject + "\n\n" + body