예제 #1
0
    def testVersion(self):
        with CaptureOutput() as captured:
            campaign(FakeArgs(version=True))

        with open(f'bombard/LICENSE.txt') as license:
            self.assertIn(license.readline(), captured.output)
        self.assertIn(bombard.version(), captured.output)
예제 #2
0
 def testSimplest(self):
     with CaptureOutput(capture=True) as captured:
         campaign(FakeArgs(example='simplest'))
     self.assertIn('GET jsonplaceholder.typicode.com/posts',
                   captured.output)
     self.assertIn('GET jsonplaceholder.typicode.com/posts/1',
                   captured.output)
예제 #3
0
 def testSimplest(self) -> None:
     with CaptureOutput(capture=True) as captured:
         campaign(FakeArgs(example="simplest"))
     self.assertIn("GET jsonplaceholder.typicode.com/posts",
                   captured.output)
     self.assertIn("GET jsonplaceholder.typicode.com/posts/1",
                   captured.output)
예제 #4
0
    def testVersion(self) -> None:
        with CaptureOutput() as captured:
            campaign(FakeArgs(version=True))

        with open("bombard/LICENSE.txt", encoding="utf8") as license:
            self.assertIn(license.readline(), captured.output)
        self.assertIn(bombard.version(), captured.output)
예제 #5
0
    def testInitSimpleton(self):
        with CaptureOutput() as captured:
            campaign(FakeArgs(example='simpleton', init=True))

        self.maxDiff = 1024
        with open(f'bombard/examples/simpleton.yaml') as desc, open(
                f'{CAMPAIGN_FILE_NAME}', 'r') as init:
            self.assertIn(desc.read(), init.read())
예제 #6
0
    def testInitDefault(self):
        with CaptureOutput() as captured:
            campaign(FakeArgs(init=True))

        self.maxDiff = 1024
        with open(f'bombard/examples/{INIT_EXAMPLE}') as ex, open(
                f'{CAMPAIGN_FILE_NAME}', 'r') as init:
            self.assertEqual(ex.read(), init.read())
예제 #7
0
    def testShowFolder(self):
        with CaptureOutput() as captured:
            campaign(FakeArgs(examples=True))

        self.maxDiff = 1024
        with open(f'bombard/examples/{DIR_DESC_FILE_NAME}') as desc:
            self.assertIn(  # do not check 1st line of output with the folder name
                markdown_for_terminal(desc.read()), captured.output)
예제 #8
0
    def testInitSimpleton(self) -> None:
        with CaptureOutput():
            campaign(FakeArgs(example="simpleton", init=True))

        self.maxDiff = 1024
        with open("bombard/examples/simpleton.yaml",
                  encoding="utf8") as desc, open(f"{CAMPAIGN_FILE_NAME}",
                                                 "r",
                                                 encoding="utf8") as init:
            self.assertIn(desc.read(), init.read())
예제 #9
0
    def testInitDefault(self) -> None:
        with CaptureOutput():
            campaign(FakeArgs(init=True))

        self.maxDiff = 1024
        with open(f"bombard/examples/{INIT_EXAMPLE}",
                  encoding="utf8") as ex, open(f"{CAMPAIGN_FILE_NAME}",
                                               "r",
                                               encoding="utf8") as init:
            self.assertEqual(ex.read(), init.read())