Commit 6d795284 authored by Tanguy Le Carrour's avatar Tanguy Le Carrour
Browse files

Reorganise interface's specs.

parent 72218dcc
......@@ -10,25 +10,27 @@ from splito.use_cases.extract_sub_tracks import (
from splito.interfaces.from_base_types import ExtractSubTracks
with describe(ExtractSubTracks):
with describe("Controllers 'from base types'"):
with before.each as self:
self.interactor = mock.create_autospec(spec=ExtractSubTracksInteractor)
with describe(ExtractSubTracks):
with it("handles good parameters"):
controller = ExtractSubTracks("a_path", ["1-2"])
with before.each as self:
self.interactor = mock.create_autospec(spec=ExtractSubTracksInteractor)
controller.call(self.interactor)
with it("handles good parameters"):
controller = ExtractSubTracks("a_path", ["1-2"])
expect(self.interactor.execute).to.have.been.called_with(
ExtractSubTracksRequest("a_path", [("1", "2")])
)
controller.call(self.interactor)
with it("handles bad parameters"):
controller = ExtractSubTracks("a_path", ["1~2.3"])
expect(self.interactor.execute).to.have.been.called_with(
ExtractSubTracksRequest("a_path", [("1", "2")])
)
controller.call(self.interactor)
with it("handles bad parameters"):
controller = ExtractSubTracks("a_path", ["1~2.3"])
expect(self.interactor.execute).to.have.been.called(
ExtractSubTracksRequest("a_path", [("1~2.3", "0")])
)
controller.call(self.interactor)
expect(self.interactor.execute).to.have.been.called(
ExtractSubTracksRequest("a_path", [("1~2.3", "0")])
)
......@@ -4,27 +4,29 @@ from robber import expect # type: ignore
from splito.interfaces.to_terminal import ExtractSubTracks
with describe(ExtractSubTracks):
with describe("Presenters 'to terminal'"):
with it("handles extracting sub-tracks"):
presenter = ExtractSubTracks()
with describe(ExtractSubTracks):
presenter.sub_track_extracted("a_path/a_file-1.mp3")
with it("handles extracting sub-tracks"):
presenter = ExtractSubTracks()
expect(presenter.exit_code()).to.eq(0)
expect(presenter.to_string()).to.contain("a_path/a_file-1.mp3")
presenter.sub_track_extracted("a_path/a_file-1.mp3")
with it("handles wrong track"):
presenter = ExtractSubTracks()
expect(presenter.exit_code()).to.eq(0)
expect(presenter.to_string()).to.contain("a_path/a_file-1.mp3")
presenter.not_an_audio_track("a_path/a_file-1.mp3")
with it("handles wrong track"):
presenter = ExtractSubTracks()
expect(presenter.exit_code()).to.eq(1)
expect(presenter.to_string()).to.contain("a_path/a_file-1.mp3")
presenter.not_an_audio_track("a_path/a_file-1.mp3")
with it("handles wrong intervals"):
presenter = ExtractSubTracks()
expect(presenter.exit_code()).to.eq(1)
expect(presenter.to_string()).to.contain("a_path/a_file-1.mp3")
presenter.wrong_interval("1", "0")
with it("handles wrong intervals"):
presenter = ExtractSubTracks()
expect(presenter.to_string()).to.contain("WARN")
presenter.wrong_interval("1", "0")
expect(presenter.to_string()).to.contain("WARN")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment