forked from openedx/cc2olx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: [FC-0063] Applying code review suggestions
- Loading branch information
1 parent
1f05e91
commit 30075bf
Showing
16 changed files
with
193 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from unittest.mock import Mock, patch | ||
|
||
from cc2olx.content_parsers import AbstractContentTypeWithCustomBlockParser | ||
|
||
|
||
@patch("cc2olx.content_parsers.abc.AbstractContentTypeWithCustomBlockParser.__abstractmethods__", frozenset()) | ||
class TestAbstractContentTypeWithCustomBlockParser: | ||
parser_type = AbstractContentTypeWithCustomBlockParser | ||
|
||
def test_parse_content_returns_none_if_idref_is_none(self): | ||
parser = self.parser_type(Mock(), Mock()) | ||
|
||
assert parser._parse_content(None) is None | ||
|
||
def test_parse_content_returns_none_if_content_type_with_custom_block_is_not_used(self): | ||
parser = self.parser_type(Mock(), Mock()) | ||
parser._context = Mock(is_content_type_with_custom_block_used=Mock(return_value=False)) | ||
parser.CUSTOM_BLOCK_CONTENT_TYPE = Mock() | ||
|
||
assert parser._parse_content(Mock()) is None | ||
|
||
def test_parse_content_returns_none_if_resource_is_not_found(self): | ||
parser = self.parser_type(Mock(), Mock()) | ||
parser._context = Mock(is_content_type_with_custom_block_used=Mock(return_value=True)) | ||
parser._cartridge = Mock(define_resource=Mock(return_value=None)) | ||
parser.CUSTOM_BLOCK_CONTENT_TYPE = Mock() | ||
|
||
assert parser._parse_content(Mock()) is None |
Oops, something went wrong.