예제 #1
0
    def test_options_property(self):
        builder = special_endpoints.CommandBuilder("OKSKDKSDK",
                                                   "inmjfdsmjiooikjsa")
        mock_option = object()

        assert builder.options == []

        builder.add_option(mock_option)

        assert builder.options == [mock_option]
예제 #2
0
    def test_build_without_optional_data(self):
        builder = special_endpoints.CommandBuilder("we are numberr", "oner")

        result = builder.build(mock.Mock())

        assert result == {
            "name": "we are numberr",
            "description": "oner",
            "options": []
        }
예제 #3
0
    def test_build_with_optional_data(self):
        mock_entity_factory = mock.Mock()
        mock_option = object()
        builder = (special_endpoints.CommandBuilder(
            "we are number", "one").add_option(mock_option).set_id(
                3412312).set_default_permission(False))

        result = builder.build(mock_entity_factory)

        mock_entity_factory.serialize_command_option.assert_called_once_with(
            mock_option)
        assert result == {
            "name": "we are number",
            "description": "one",
            "default_permission": False,
            "options":
            [mock_entity_factory.serialize_command_option.return_value],
            "id": "3412312",
        }
예제 #4
0
    def test_default_permission(self):
        builder = special_endpoints.CommandBuilder(
            "oksksksk", "kfdkodfokfd").set_default_permission(True)

        assert builder.default_permission is True
예제 #5
0
    def test_id_property(self):
        builder = special_endpoints.CommandBuilder(
            "OKSKDKSDK", "inmjfdsmjiooikjsa").set_id(3212123)

        assert builder.id == 3212123
예제 #6
0
    def test_name_property(self):
        builder = special_endpoints.CommandBuilder("NOOOOO", "OKKKK")

        assert builder.name == "NOOOOO"
예제 #7
0
    def test_description_property(self):
        builder = special_endpoints.CommandBuilder("ok", "NO")

        assert builder.description == "NO"