Skip to content

Latest commit

 

History

History
107 lines (84 loc) · 11.8 KB

File metadata and controls

107 lines (84 loc) · 11.8 KB

TDEI Python OSW Validation Service Unit Test Cases

Purpose

This document details the unit test cases for the TDEI-python-osw-formatter


Test Framework

Unit test cases are to be written using Python Unittest


Test Cases

Test cases table definitions

  • Component -> Specifies the code component
  • Class Under Test -> Target method name
  • Test Target -> Specific requirement to test_ ex. Functional, security etc.
  • Scenario -> Requirement to test
  • Expectation -> Expected result from executed scenario

Python unittest code pattern

import unittest

class TestStringMethods(unittest.TestCase):

    def test_upper(self):
        self.assertEqual('foo'.upper(), 'FOO')

    def test_isupper(self):
        self.assertTrue('FOO'.isupper())
        self.assertFalse('Foo'.isupper())

    def test_split(self):
        s = 'hello world'
        self.assertEqual(s.split(), ['hello', 'world'])
        # check that s.split fails when the separator is not a string
        with self.assertRaises(TypeError):
            s.split(2)

if __name__ == '__main__':
    unittest.main()

Test cases

Component Class Under Test Test Target Scenario Expectation Status
Model Upload Functional When requested with upload data Expect to return same upload data
Model Upload Functional When requested with upload data_from Expect to return same upload data_from
Model Upload Functional When requested with upload message Expect to return same upload message
Model Upload Functional When requested with upload id Expect to return same upload id
Model Upload Functional When requested with upload type Expect to return same upload type
Model Upload Functional When requested with upload publish date Expect to return same upload publish date
Model Upload Functional When requested with upload to_json Expect to return same dict
-- -- -- -- -- --
Model UploadData Functional When requested with stage parameter Expect to return stage
Model UploadData Functional When requested with tdei_project_group_id parameter Expect to return tdei_project_group_id
Model UploadData Functional When requested with tdei_record_id parameter Expect to return tdei_record_id
Model UploadData Functional When requested with user_id parameter Expect to return user_id
-- -- -- -- -- --
Model TestRequest Functional When requested with tdei_project_group_id parameter Expect to return tdei_project_group_id
-- -- -- -- -- --
Model TestMeta Functional When requested with file_upload_path parameter Expect to return file_upload_path
-- -- -- -- -- --
Model TestResponse Functional When requested with response parameter Expect to return either True or False
-- -- -- -- -- --
OSWFomatter TestOSWFormatter Functional When requested for format function Expect to return format
OSWFomatter TestOSWFormatter Functional When requested for format function Expect to return format and generate xml file in directory storage
OSWFomatter TestOSWFormatter Functional When requested for format function with invalid parameters Expect to fail
OSWFomatter TestOSWFormatter Functional When requested for download_single_file function Expect to return True
-- -- -- -- -- --
OSWFomatter TestOSWFormatDownload Functional When requested for download_single_file function withvalid endpoint Expect to download files in local storage
-- -- -- -- -- --
OSWFomatter TesOSWFormatCleanUp Functional When requested for clean_up function if file exists Expect to remove that file
OSWFomatter TesOSWFormatCleanUp Functional When requested for clean_up function if folder exists Expect to remove that folder
OSWFomatter TesOSWFormatCleanUp Functional When requested for clean_up function id file not exists Expect to raise exception
-- -- -- -- -- --
OSWFomatter TestOSWFormatter Functional When calling subscribe function Expect to return a message
OSWFomatter TestOSWFormatter Functional When calling send_status function with valid parameters Expect to return valid parameters
OSWFomatter TestOSWFormatter Functional When calling send_status function with upload url Expect to upload the file to container
OSWFomatter TestOSWFormatter Functional When calling send_status function with invalid parameters Expect to return a invalid message
OSWFomatter TestOSWFormatter Functional When calling upload_to_azure function with valid parameters Expect to upload the file to container
OSWFomatter TestOSWFormatter Functional When calling upload_to_azure function with invalid parameters Expect not to upload the file to container
-- -- -- -- -- --
Server TestApp Functional When calling get_settings function Expect to return env variables
Server TestApp Functional When calling ping function Expect to return 200
Server TestApp Functional When calling root function Expect to return 200

Integration Test cases

In case of integration tests, the system will look for all the integration points to be tested

Component Feature under test Scenario Expectation Status
OSWFomatter Servicebus Integration Subscribe to upload topic to verify servicebus integration Expect to return message
OSWFomatter Servicebus Integration Should publish a message to be received on topic Expect to receive message on target topic
OSWFomatter Storage Integration Fetching a file returns a file entity Expect to return the file entity
OSWFomatter Storage Integration Should upload to storage container Expect to return the uploaded url
OSWFomatter Functional Ween calling format function Expect to format the file, download it to local and upload it to azure container and publish the message